Link to home
Start Free TrialLog in
Avatar of brightsea
brightsea

asked on

how to show hint window when the window is not active?

When my form is not active and I move mouse on a button, I want to show the hint window of the button.How can I do?
Avatar of RickHalle
RickHalle

You might be able to use this:
http://www.undu.com/Articles/991012d.html

Rick Halle
Did that help?
Avatar of brightsea

ASKER

Thank you,RickHalle.
But my question isn't that.I sad hint window is the hint when I set the Hint property of the button and I set ShowHint := true.
Maybe you can tell me the message to show the hint.
thanks.
The catch is the active window part. You can fire the hint fairly easy using the Application.OnHint event and put it wherever you want. The problem I see is that the hint will not fire if the window is not active. I noticed the sample in the link I provided shows a hint window for the form even if it is not active. If you could instead get the hint for the control the cursor was over then you could show the hint for that control. (Instead of the xy coordinates) I know it is not a direct answer but it appeared that with a bit of work it could be coerced into working for buttons also. I played with it a little and was able to get it to pop up a hint window over the buttons by moving the form mousemove stuff to the button mousemove. When I did the window was flashing so it needed more work to find out why and then load the tip into it for the control(button).

Rick Halle
ASKER CERTIFIED SOLUTION
Avatar of RickHalle
RickHalle

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks.
Hi,
Nice to see that for once an article that I write is usefull ;)
John...
Small fix jeurk - BTW nice trick :)

procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
 Y: Integer);
var
    pt,P: TPoint;
    sText: string;
begin
    if not isTracking then
    begin
         if not TrackMouseEvent(evtTrack) then
              MessageDlg('Sorry, I' + #39 + 'm not in the mood of tracking' + #13 + #10 + 'your stupid events.', mtError, [mbOK], 0);
         isTracking := True;
    end;
    GetCursorPos(P);
    if  (FindDragTarget(P, True) = Button1) then begin
    getCursorPos(pt);
    sText := Button1.Hint;
    hwHint.ActivateHint(Rect(pt.x + 10, pt.y + 10, pt.x + hwHint.Canvas.TextWidth(sText) + 19,
         pt.y + hwHint.Canvas.TextHeight(sText) + 10), sText);

    UpdateTracking;
    end
    else hwHint.ReleaseHandle;
end;
Very very good!

I was just wondering how to show hints in c#?
does anybody know about that?

Marcelo Miorelli