Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Thread Tools Display Modes
Old 12-20-2001, 05:32 AM
Mucan Mucan is offline
Senior Member
Join Date: Feb 2001
Posts: 121
Default showhint in DBgrid?

how can I do this;
if mouse on dbgrid then;
DBGrid1.hint:=Table1.FieldByName('Odeme').Asstring ;
BUT it's NOT show current record! It show, mouse on which record.

Like this; if current record=4 and mouse on 8. record
then it show 8.record information!
Reply With Quote
Old 12-20-2001, 05:55 AM
andyho andyho is offline
Senior Member
Join Date: Jul 2001
Posts: 1,446
Default RE: showhint in DBgrid?

You can use Application.OnShowHint for that - this event will be called every time a hint is about to be shown. In this event you then can check if the event is for your dbgrid, then convert the mouse coordinates to find the record (dunno how, I didn't used the dbgrid much yet), and then change the text accordingly:

procedure TForm1.MyShowHint(var HintStr: string; var CanShow: Boolean; var HintInfo: THintInfo);
position: TGridCoord;
if hintinto.hintcontrol=dbgrid1 then begin
position:=dbgrid1.MouseCoord(hintinfo.cursorpos.x, hintinfo.cursorpos.y);

and put a Application.OnShowHint:=form1.myshowhint in the OnShow event of the form. You can also move the position on the hintwindow to be close to the active cell, and if you also want the hint to reshow after moving to another cell you will need to save the last showed hintcell, and do a Application.CancelHint when the mouse moves out of that cell.

Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:35 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.