Ultragrid - programmatically applying focus to cell with cur

Posted by Admin on 14-Jan-2009 08:47

I have not been able to programmatically apply focus (with cursor) to the first cell of an editable ultragrid. I have used just about every permutation of the ultragrid1:PerformAction() method that I could find in the class browser with no luck. I can get the cell to appear highlighted, but have to manually click in the grid to begin typing. Any help/suggestions would be much appreciated.

All Replies

Posted by Admin on 14-Jan-2009 10:17

Answered my own question (with help from Infragistics forum).

Set the TabIndex of the ultragrid = 0.

/* subscribe to 'enter' event */

THIS-OBJECT:ultraGrid1:Enter:SUBSCRIBE(THIS-OBJECT:onGridEnter).

METHOD PRIVATE VOID onGridEnter

( INPUT sender AS System.Object, INPUT e AS System.EventArgs ):

ApplyFocus( ).

RETURN.

END METHOD.

METHOD PRIVATE VOID ApplyFocus( ):

DEFINE VARIABLE curRow AS Infragistics.Win.UltraWinGrid.UltraGridRow NO-UNDO.

curRow = ultragrid1:Rows:Item[0].

ultraGrid1:PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction:FirstCellInRow).

curRow:Cells[0]:Activate().

ultragrid1:PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction:EnterEditMode).

END METHOD.

This thread is closed