Forum > LCL

StringGrid - How to force a selection of a specific cell

(1/1)

maKiaveL:
How can I force a selection of a specific cell in StringGrid?
For instance, when I run a search I want the first cell to be already selected without having to click.

Thank you very much

theo:
This?


--- Code: ---StringGrid1.Row:=20;
StringGrid1.Col:=5;
StringGrid1.SetFocus;

--- End code ---

maKiaveL:
No, because that only "set focus" on the cell, doesnt actually select it, since it does not what it's in the OnSelectCell event...

faber:
You can run OnSelectCell manualy

--- Code: ---StringGrid1.Row:=20;
StringGrid1.Col:=5;
StringGrid1SelectCell(self,20,5,cansel);
StringGrid1.SetFocus;
--- End code ---

maKiaveL:
yeah, that works, thks!

Navigation

[0] Message Index

Go to full version