[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1904
  • Last Modified:

Hint for each row in dbgrid.. not for dbgrid itself

Hello,

i have a dbgrid showing data from database, i see that hint property is general, i want a method doing showing hint from database and according to the current record.

is that allowed?  and how?
0
speedbit
Asked:
speedbit
  • 3
1 Solution
 
MerijnBSr. Software EngineerCommented:
Capture the OnMouseMove event of the grid.
Figure out what record you're hovering on and set the controls general hint to the text you want for that record.
0
 
speedbitAuthor Commented:
thank you but would u type the code please ?
0
 
MerijnBSr. Software EngineerCommented:
try this:

procedure TForm11.DBGrid1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var GridCoord: TGridCoord;
begin
 GridCoord := DBGrid1.MouseCoord(X, Y);
 DBGrid1.Hint := IntToStr(GridCoord.X) + ' - ' + IntToStr(GridCoord.Y);
end;



Make sure the ShowHint property of the DBGrid is set to true.
You'll have to set the proper text of the hint yourself.
0
 
MerijnBSr. Software EngineerCommented:
maybe this is even a better solution: http://www.scalabium.com/smdbgrid.htm
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now