Board index » delphi » dynamic hint on MouseMove

dynamic hint on MouseMove

Hi,

I like to display a variable (dynamic) hint when a user moves the mouse
over different parts of the component.
I use the On MouseMove event of the component to change the components
hint property according to the needs, but only the first hint is shown.

When the mouse enters the Component, the first hint is shown and
disappears after "Application.HintHidePause". No new hint appears until I
leave the component or click on it !?! (the OnClick does the same
processing as the OnMouseOver)

Setting ShowHint to False (or true or both) doesn't help .

Any ideas?

Ciao, Paul

 

Re:dynamic hint on MouseMove


You need hook a CM_HINTSHOW message.
Look example:

type
  TSMDBGrid = class(TDBGrid)
  private
    <...>
    procedure CMHintShow(var Msg : TMessage); message CM_HINTSHOW;
  end;

procedure TSMDBGrid.CMHintShow(var Msg: TMessage);
var ACol, ARow: Integer;
    OldActive: Integer;
begin
   with PHintInfo(Msg.LParam)^  do
     try
       HintStr := Hint;

       Msg.Result := 1;
       if not DataLink.Active then Exit;

       TDrawGrid(Self).MouseToCell(CursorPos.X, CursorPos.Y, ACol, ARow);
       CursorRect := CellRect(ACol, ARow);
       ACol := ACol - IndicatorOffset;
       if (ACol < 0) then Exit;
       ARow := ARow - TitleOffset;
       HintPos := ClientToScreen(CursorRect.TopLeft);
       if (ARow < 0) then
       begin
         HintStr := Columns[ACol].Title.Caption;
         Msg.Result := 0;
      end;
    except
      Msg.Result := 1;
    end;
end;

--
With best regards, Mike Shkolnik.
FIDO: 2:463/106.14
E-Mail: mshkol...@rs-ukraine.kiev.ua
        m...@woccu.freenet.kiev.ua
WEB: http://www.geocities.com/SiliconValley/Grid/3989

Paul Sommer D??? ???Y?? ...

Quote
>Hi,

>I like to display a variable (dynamic) hint when a user moves the mouse
>over different parts of the component.
>I use the On MouseMove event of the component to change the components
>hint property according to the needs, but only the first hint is shown.

>When the mouse enters the Component, the first hint is shown and
>disappears after "Application.HintHidePause". No new hint appears until I
>leave the component or click on it !?! (the OnClick does the same
>processing as the OnMouseOver)

>Setting ShowHint to False (or true or both) doesn't help .

>Any ideas?

>Ciao, Paul

Re:dynamic hint on MouseMove


Quote
>>I like to display a variable (dynamic) hint when a user moves the mouse
>>over different parts of the component.
>>I use the On MouseMove event of the component to change the components
>>hint property according to the needs, but only the first hint is shown.

sorry, i missed the beginning of this thread however, i wrote an article for
UNDU
recently on just this topic (using the statusbar component as an example).

Look at
http://www.undu.com

aj

Other Threads