select row datagrid and display in another datagrid
Posted: Fri Oct 21, 2022 10:24 pm
when i select the first row it doesn't show only the data of the first row, it shows all the data of the table in the second datagrid
Add the following property to the form in the Init
ADDPROPERTY(Thisform,"returnobj", null )
in the edit button add the code
SELECT (thisform.Grid2.RecordSource) && selects the cursor area of the grid control.
Thisform.ReturnObj = Newobject("Empty")
SCATTER NAME thisform.ReturnObj
Thisform.Release()
In the UNLOAD event of the grid form
RETURN Thisform.ReturnedObj
add this code to position the cursor in the first row of the datagrid, when selecting only the first row it appears in the second datagrid but it does not work. Create the property movefirstgrid and its default value will be .F in the form add to the click event
thisform.movefirstgrid=.T.
thisform.grdprices.setfocus
in the grid add to the setfocus event
if thisform.movefirstgrid
this.activatecell(1,1)
endif
thisform.movefirstgrid=.F.
in the second datagrid only the data of the first row is not show
Add the following property to the form in the Init
ADDPROPERTY(Thisform,"returnobj", null )
in the edit button add the code
SELECT (thisform.Grid2.RecordSource) && selects the cursor area of the grid control.
Thisform.ReturnObj = Newobject("Empty")
SCATTER NAME thisform.ReturnObj
Thisform.Release()
In the UNLOAD event of the grid form
RETURN Thisform.ReturnedObj
add this code to position the cursor in the first row of the datagrid, when selecting only the first row it appears in the second datagrid but it does not work. Create the property movefirstgrid and its default value will be .F in the form add to the click event
thisform.movefirstgrid=.T.
thisform.grdprices.setfocus
in the grid add to the setfocus event
if thisform.movefirstgrid
this.activatecell(1,1)
endif
thisform.movefirstgrid=.F.
in the second datagrid only the data of the first row is not show