bruno-pere Posted June 18, 2013 Share Posted June 18, 2013 Hi! I need to get the row and col when the user selects a new cell in the grid. The user can change using mouse or keyboard. Anyone know how to get this? I tried using OnCellClick but it fires only when the user clicks the mouse. I need to get after using the keyboard too. Thank you! Bruno Quote Link to comment Share on other sites More sharing options...
jeans_larghi Posted June 18, 2013 Share Posted June 18, 2013 procedure UniForm1.UniDBGrid1AjaxEvent(Sender: TComponent; EventName: string; Params: TStrings); begin if EventName = 'select' then begin editrow.Text := 'row = '+Params.ValueFromIndex[5]; editcolumn.Text := 'column = '+Params.ValueFromIndex[6]; end; end; Quote Link to comment Share on other sites More sharing options...
bruno-pere Posted June 18, 2013 Author Share Posted June 18, 2013 Thank you! Solved here too. function OnCellclick(sender, rowIndex, columnIndex, e){ var me = MainForm.UniDBGrid1; pos = me.getSelectionModel().getCurrentPosition(); //alert(pos.column); ajaxRequest(MainForm.UniDBGrid1, 'CellChanged', ['col='+pos.column,'row='+pos.row]);} function OnKeypress(e){ var me = MainForm.UniDBGrid1; pos = me.getSelectionModel().getCurrentPosition(); //alert(pos.column); ajaxRequest(MainForm.UniDBGrid1, 'CellChanged', ['col='+pos.column,'row='+pos.row]);} OnAjaxEvent var col, row: string;begin if EventName='CellChanged' then begin col := Params.Values['col']; row := Params.Values['row']; if (UpperCase(col)<>'UNDEFINED')and(UpperCase(row)<>'UNDEFINED') then begin UniLabel1.Text := 'Col: ' + col + ', Row: ' + row; end; end; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.