Recent

Author Topic: emulate a cell click  (Read 6247 times)

mtdew3q

  • Guest
emulate a cell click
« on: August 10, 2005, 03:10:40 pm »
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

  • Sr. Member
  • ****
  • Posts: 470
RE: emulate a cell click
« Reply #1 on: August 10, 2005, 07:40:23 pm »
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: [Select]

procedure TForm1.Button1Click(Sender: TObject);
begin
  dbGridIncome.SelectedIndex:=1;
  dbGridIncome.EditorMode := true;
end;

That should have the effect of clicking the second field in the current selected record to start editing.

Anonymous

  • Guest
RE: emulate a cell click
« Reply #2 on: August 10, 2005, 09:16:59 pm »
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

 

TinyPortal © 2005-2018