Forum > Databases
emulate a cell click
(1/1)
mtdew3q:
Hi- ver .98 win tdbf
for this property i got some code off the internet for use with delphi.
property SelectedIndex: Integer; [rw]
procedure TForm1.Button1Click(Sender: TObject);
Var
Column:TColumn;
begin
dbGridIncome.SelectedIndex:=1;
dbGridIncome.SetFocus;
dbGridIncome.OnCellClick(Column)
end;
this property seems to be public and a descendant of tdbgrid so it should be available right...unless i am not setting it correctly (probably the case)
i'd kind of like to get a programmable cell click working because
on arrival at the grid i'd like to have col 0 ready to edit without
clicking.
i just learned tonight that it is better to use the reference in the wiki then figure out what is and isnt available on code complete for now.
this isnt a huge deal but if you know right off i'd apreciate the tip.
thanks,
jim
jesusr:
SelectedIndex was implemented a week ago, you will need a recent Lazarus version.
I just made stringgrid and dbgrid property EditorMode public so you could do something like:
--- Code: ---
procedure TForm1.Button1Click(Sender: TObject);
begin
dbGridIncome.SelectedIndex:=1;
dbGridIncome.EditorMode := true;
end;
--- End code ---
That should have the effect of clicking the second field in the current selected record to start editing.
Anonymous:
thanks jesusr,
that code snippet will come in handy when i upgrade my version.
i am having lots of fun with lazarus. it is really impressive.
later,
jim
Navigation
[0] Message Index