Page 1 of 1

Position in datagrid at will/Posicionarse en datagrid a voluntad

Posted: Tue Feb 27, 2018 12:22 pm
by jgayoso
I have a datagrid that displays 8 rows with the data of the alphabet. Also I have a button to search where I entered a letter to search. The idea is to display the entered data to search and display it in the following way:
J
K
L
M
N
O
P
Q
After searching you can move with the mause, usually by the datagrid.


Tengo un datagrid que despliega 8 filas con los datos del abecedario. Ademas tengo un button buscar donde ingreso una letra a buscar. La idea es desplegar el dato ingresado a buscar y mostrarlo de la siguiente forma:
J
K
L
M
N
O
P
Q
Después de buscado se pueda de desplazarse con el mause, normalmente por el datagrid.

Jorge Gayoso
Desde el sur del mundo - Chile

Re: Position in datagrid at will/Posicionarse en datagrid a voluntad

Posted: Tue Feb 27, 2018 2:55 pm
by dunbarx
Hi.

Not sure exactly what your question is.

But know that you can extract the entire contents of a dataGrid and then do anything you want within LC proper (pseudo):

Code: Select all

put the dgData of group "yourDataGrid" into temp --get the contents into a normal variable
put lineOffset(yourChar,temp) into tLine --find a char 
set the dgVScroll of group "yourDataGrid" to the value of tLine based on the textHeight, etc. of the DG
That sort of thing...

Craig Newman

Re: Position in datagrid at will/Posicionarse en datagrid a voluntad

Posted: Tue Feb 27, 2018 7:07 pm
by jgayoso
Dunbarx , thank you very much.

With the instruction:

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

I was able to solve my problem.

A great greeting from the south of the world.

Jorge Gayoso

Re: Position in datagrid at will/Posicionarse en datagrid a voluntad

Posted: Tue Feb 27, 2018 11:50 pm
by dunbarx
Great.

How did you determine the "line height"? Did you divide the formattedHeight by the number of lines?

Craig

Re: Position in datagrid at will/Posicionarse en datagrid a voluntad

Posted: Wed Feb 28, 2018 3:58 pm
by jgayoso
This was my solution:

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

Re: Position in datagrid at will/Posicionarse en datagrid a voluntad

Posted: Wed Feb 28, 2018 6:24 pm
by dunbarx
Aha. dgProp["Row Height"].

Much better than doing the math.

Craig