Delphi Pages Forums  

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

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 05-22-2005, 12:19 AM
DJK DJK is offline
Senior Member
 
Join Date: Aug 2002
Posts: 1,379
Default DBGrid Hint

Can I show a hint (yellow bar style, NOT statusbar style) when a user hoovers over a certain title column of a dbgrid ?
Reply With Quote
  #2  
Old 05-22-2005, 03:43 AM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: DBGrid Hint

You will need to create a descendent component (from TDBGrid) and write your own command message (easier said then done)

type
TXDBGrid = class(TDBGrid)
private
procedure CMHintShow(var Msg : TMessage); message CM_HINTSHOW;
end;


procedure TXDBGrid.CMHintShow(var Msg: TMessage);
begin
//write here
end;

If you are a delphi novice, I recommend you find a TDBGrid component (Freeware, shareware, commercial) which has the feature already.

UnSysApps
Reply With Quote
  #3  
Old 05-22-2005, 06:56 AM
mshkolnik mshkolnik is offline
Senior Member
 
Join Date: Jul 2001
Posts: 4,195
Default RE: DBGrid Hint

Just set the ShowHint=True for grid (or better for parent form) and use the Hint property of grid to specify the hint text

If you use the TSMDBGrid, you may also include the eoCellHint flag in ExOptions property( to display the long texts from field as hint) or use the HintField property/OnCellHint event (to change the hint text depends from current record)

With best regards, Mike Shkolnik
http://www.scalabium.com
Reply With Quote
  #4  
Old 05-22-2005, 08:49 AM
DJK DJK is offline
Senior Member
 
Join Date: Aug 2002
Posts: 1,379
Default RE: DBGrid Hint

I thin kI can do something like this:

procedure TForm1.SMDBGrid4MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
TSMDBGrid(Sender).Hint := 'test';
end;

but how can use different hints for different column titles ?
Reply With Quote
  #5  
Old 05-22-2005, 09:21 AM
DJK DJK is offline
Senior Member
 
Join Date: Aug 2002
Posts: 1,379
Default RE: DBGrid Hint

never mind, found it for reference:

var
pt: TGridcoord;
begin
pt:= SMDBGrid4.MouseCoord( x, y ) ;
if (pt.y=0) and (pt.X=1) then
TSMDBGrid(Sender).Hint := 'test';
end;
Reply With Quote
  #6  
Old 05-22-2005, 01:26 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: DBGrid Hint

Yeah, but that does not show it in a Yellow Bar!

If you wanted just the standard hint drawn, then we could have helped ya sooner!

<SMILE>

UnSysApps
Reply With Quote
Reply

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:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.