Scalabium Software

SMReport Autogenerated
Knowledge for your independence'.
Home Delphi and C++Builder tips


#92: How can I switch a DBGrid in edit mode and set a cursor in some position?

Sometimes in development you must control the edit mode of your DBGrid and, for example, to place a cursor in some position for user typing. You can view the next code, which show how you can solve this task:

procedure TForm1.Button1Click(Sender: TObject);
var
  h: THandle;
begin
  {set a focus to DBGrid}
  DbGrid1.SetFocus;

  {switch to edit mode}
  DbGrid1.EditorMode := True;

  {receive the handle of current window with edit}
  h := Windows.GetFocus;

  {send the EM_SETSEL.
   You must include the two parameters: the start position of cursor and end
   position of selection. In the next example, I set a cursor in position of
   third character without any selection}
  SendMessage(h, EM_SETSEL, 3, 3);
end;


Published: July 24, 2000

See also
 
Paradox ActiveX
Database Information Manager
Mail parser (ActiveX)
Word Web-stream
SMMsg suite
Viewer for MS Outlook Messages
Clarion to Text converter
Excel Reader (dll)
Paradox Viewer
Paradox to MS Access converter
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2019, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMReport Autogenerated