Board index » delphi » Setting dbGrid field to edit

Setting dbGrid field to edit

I wish to programaticly set a dbGrid field to edit.  I suspect I need
to send a message but I'm not sure.  Any suggestions?
Dennis Powers
PC/POLL SYSTEMS
V 319-556-2323
F 319-556-0835
Den...@pcpoll.com
 

Re:Setting dbGrid field to edit


You can simulate a F2 keystroke:
  DBGrid1.SetFocus;
  SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_F2,0);

Re:Setting dbGrid field to edit


Quote
On Thu, 1 Oct 1998 09:42:15 +0200, "C. Ballester" <c...@ctv.es> wrote:
>You can simulate a F2 keystroke:
>  DBGrid1.SetFocus;
>  SendMessage(DBGrid1.Handle, WM_KEYDOWN, VK_F2,0);

Thanks, It works like a charm!

Any reason not to use PostMessage?

I was able to find WM_KEYDOWN help with the F1 thanks to you pointing
it out but the VK_F2 is still obscure.  I did find a table of keys in
The Tomes of Delphi 3 but not prominently.  Do you know of any other
documentation that covers this area?  Whenever I learn something new I
try and cross reference it to the documentation sources because I know
I'll be asking the sam question again if I don't.

Dennis Powers
PC/POLL SYSTEMS
V 319-556-2323
F 319-556-0835
Den...@pcpoll.com

Re:Setting dbGrid field to edit


Quote
> I wish to programaticly set a dbGrid field to edit.  I suspect I need
> to send a message but I'm not sure.  Any suggestions?

Dennis,

try something like

   dbgrid.selectedindex := columntoedit;
   dbgrid.datasource.edit;

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitely requested!

Other Threads