:: Forum >>

Grid Tabbing to Next Cell

Just converted from 2.0.2 to 2.5.1 and have eveyrthing working except for automatica tabbing to the next cell I sued the following code:

//Allows Tab to next cell
obj.setController("myTabKeys",
{
onKeyTab: "selectNextCell",
onKeyShiftTab: "selectPreviousCell", onKeyLeft: "selectPreviousCell",
onKeyRight: "selectNextCell"
});

Any ideas I want key navigation using left/right arrows or tab keys...It worked in 2.0.2 but not sure if something changed.
Rick
Saturday, April 12, 2008
The previous code relied on the internal 2.0 events which are no longer used in AW 2.5. Here is 'tab to next cell' code for AW 2.5.1 -

obj.setController("myTabKeys", {
    onKeyTab: function(event){
        if (this.getCurrentColumn() != this.getLastColumn()){
            this.selectCell(this.getNextColumn(), this.getCurrentRow());
        }
        else if (this.getCurrentRow() != this.getLastRow()){
            this.selectCell(this.getFirstColumn(), this.getNextRow());
        }
        else {
            return; // allow default tab action - jump to the next control
        }
        AW.setReturnValue(event, false);
    },
    onKeyShiftTab: function(event){
        if (this.getCurrentColumn() != this.getFirstColumn()){
            this.selectCell(this.getPreviousColumn(), this.getCurrentRow());
        }
        else if (this.getCurrentRow() != this.getFirstRow()){
            this.selectCell(this.getLastColumn(), this.getPreviousRow());
        }
        else {
            return; // allow default shift-tab action - jump to the previous control
        }
        AW.setReturnValue(event, false);
    }
});


The new code also jumps to the next row when you are on the last cell, and jumps to the next control if you are at the last cell of the last row.
Alex (ActiveWidgets)
Monday, April 14, 2008

This topic is archived.


Back to support forum

Forum search