Forum > Beginners

StringGrid Questions

(1/2) > >>

JLWest:
I have 2 TSringGrids on a form with loaded data.

I would like to click on a row in a grid in using code.
I know the row and column. If I click on the column with the mouse it loads a second grid on the form with data. Can I do this all in code?

Thanks.

dsiders:

--- Quote from: JLWest on December 31, 2022, 04:52:44 am ---I have 2 TSringGrids on a form with loaded data.

I would like to click on a row in a grid in using code.
I know the row and column. If I click on the column with the mouse it loads a second grid on the form with data. Can I do this all in code?

Thanks.

--- End quote ---

Write an OnSelectCell event hander in the first grid to do whatever you need to the second grid.

JLWest:
i can see where the right grid would be loaded with the proper file but what about the left grid.

Don't I have to click a row on the left Grid to get the onSelectEvent to fire?
Thanks
 

KodeZwerg:
You are expressing yourself a little bit... unclear.
Please write down exactly how you wish that things shall happen.
Like "Click in Grid1 shall start action for Grid2", then we are what dsiders suggested, in an OnClick event.
Best would be to have a small demo app from you that helping people can just integrate things you are missing.

bytebites:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.grid1SelectCell(Sender: TObject; aCol, aRow: Integer;  var CanSelect: Boolean); You can call  it as you wish

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var select:booleanbegin  grid1SelectCell(grid1,3,4,select)end; 

Navigation

[0] Message Index

[#] Next page

Go to full version