Selection and focus of line in datagrid/Seleccion y foco de linea en datagrid

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jgayoso
Posts: 13
Joined: Fri Jan 26, 2018 3:25 pm

Selection and focus of line in datagrid/Seleccion y foco de linea en datagrid

Post by jgayoso » Wed Feb 28, 2018 4:06 pm

Ingles:
I want to change the selected line and focus of a datagrid, without using the mouse, for example by means of a button:
If I press button A, row A is displayed as active and with focus in the datagrid.
If I press button E, row E is displayed as active and with focus in the datagrid.
If I press button G, row G is displayed as active and with focus in the datagrid.

Español:
Deseo cambiar la linea seleccionada y foco de un datagrid, sin usar el mouse, por ejemplo por medio de button:
Si presiono button A se despliega en el datagrid la fila A como activa y con el foco.
Si presiono button E se despliega en el datagrid la fila E como activa y con el foco.
Si presiono button G se despliega en el datagrid la fila G como activa y con el foco.

Example/Ejemplo:
BUTTON A
----
A
----
B
C
D
E
F
G

BUTTON E
A
B
C
D
----
E
----
F
G



BUTTON G
A
B
C
D
E
F
----
G
----

jgayoso
Posts: 13
Joined: Fri Jan 26, 2018 3:25 pm

Re: Selection and focus of line in datagrid/Seleccion y foco de linea en datagrid

Post by jgayoso » Wed Feb 28, 2018 5:41 pm

I already solve it with:

set the dgHilitedIndex of group "DataGrid_1" to tNLinea_DataGrid


Function fPosiciona_DataGrid tTexto, tNAntes
dispatch "FindIndex" to group "DataGrid_1" with "carta_descripcion", tTexto
put the result into tNLinea_DataGrid

put (the dgProp["Row Height"] of group "DataGrid_1") * (tNLinea_DataGrid - tNAntes) into tLine

set the dgVScroll of group "DataGrid_1" to the value of tLine

set the dgHilitedIndex of group "DataGrid_1" to tNLinea_DataGrid

end fPosiciona_DataGrid

Greetings from the south of the world

Jorge Gayoso

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”