Topic: script like pressing with mouse in tablegrid

frmCreateprotypa.TableGrid2.SelectedRow:=0;
frmCreateprotypa.TableGrid2.OnCellClick;

I use this script to show the first Row of a table. The other I wanna  do is to select this row by script, like I use the mouse to press it, But I falid.
Any idea??

Re: script like pressing with mouse in tablegrid

Hi,
What 'event' are you attaching your script to?
If you use form1_onshow or form1_tablegrid1_onchange it should highlight (in blue) the selected row as if you had clicked on that row using the mouse (see attached).
Derek.

Post's attachments

Attachment icon selectfirstrow.zip 336.33 kb, 129 downloads since 2022-06-18 

Re: script like pressing with mouse in tablegrid

Hi, I just tried Derek's code "selectfirstrow.zip" and here is the error message that comes up. My table contains data and when I select the rows with the keyboard keys the error message appears.

Post's attachments

Attachment icon Lignes.jpg 10.2 kb, 65 downloads since 2022-06-18 

Destiny

Re: script like pressing with mouse in tablegrid

Hi Derek, Destiny


Derek's code has nothing to do with it.
As far as I remember, you have errors in the OnKeyUp event for TableGrid when using SQLExecute.