Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 4, DBGrid selected cell coordinates

by Mike Orriss Email: Anonymous


DBGrid selected cell coordinates
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For Delphi, Version 1.0  to 6.0 650 downloads
Copyright: No significant restrictions


Size: 421 bytes
Updated on Thu, 18 Oct 2001 23:23:28 GMT
Originally uploaded on Sat, 01 Jul 2000 00:00:00 GMT
SHA1 Hash: 8D7D3D178FC57BA5098239CBFD8C4B39F975E501
MD5 Hash: 30547BF27EBF3C324C302F830345A78F

    Explore the files in this upload

Description
Question: Is there a way to figure out the coordinates(specifically, left and top) of the currently selected Cell in a DBGrid

Answer: If you have globally declared variables 'CurrentLeft' and 'CurrentTop', you can keep their values current via the OnDrawDataCell event:

procedure TMainForm.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState);
begin
if gdFocused in State then begin
CurrentLeft := Rect.Left;
CurrentTop := Rect.Top;
end;
end;

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Server Response from: ETNACDC03