Jose has sure made some things easy to do. I had tooltips up and running in 3 min, 27 sec...yes I timed myself 8)
This is all I had to do and a sample screenshot is attached for your viewing pleasure...
Global gTooltipHwnd As Dword
' Create tooptip
Local pWindow As IWindow
pWindow = Class "CWindow"
gTooltipHwnd = pWindow.AddTooltip (HWND_MAIN_INTERNETICON, "No Internet access.",%TRUE)
Tooltip_SetTitle (gTooltipHwnd, %TTI_INFO, "Internet Availability")
' Update tooltip text
pWindow.SetTooltipText (gTooltipHwnd, HWND_MAIN_INTERNETICON, "Internet accessible." + " Public IP: " + sPublicIP)
I'm beginning to grow fond of this Jose guy...
Rick Kelly
If you don't have already a reference to the CWindow class, it's better to use the wrappers in TooltipCtrl.inc, since pWindow = Class "CWindow" has more overhead. It is intended to create forms and popup windows.
Global gTooltipHwnd As Dword
' Create tooptip
gTooltipHwnd = Tooltip_Add (HWND_MAIN_INTERNETICON, "No Internet access.",%TRUE)
Tooltip_SetTitle (gTooltipHwnd, %TTI_INFO, "Internet Availability")
' Update tooltip text
Tooltip_SetText (gTooltipHwnd, HWND_MAIN_INTERNETICON, "Internet accessible." + " Public IP: " + sPublicIP)
Excellent!
Quote from: Rolf Brandt on December 07, 2011, 10:56:45 AM
Excellent!
Isn't he though? :o
Now, just how do you get a tooltip to pop up programmatically when the mouse cursor is somewhere else? ???
The popup function isn't making it happen.
Rick Kelly
You can't. They are designed to pop up when the user pauses the mouse pointer over a UI element.
Quote from: Richard Kelly on December 08, 2011, 01:00:45 AM
Now, just how do you get a tooltip to pop up programmatically when the mouse cursor is somewhere else?
What types of situations would you want that Richard?
QuoteWhat types of situations would you want that Richard?
I could think of a neat situation to use it for. For instance to tip a user about a button/area *he have not clicked, but could be beneficial to know about â€" a tip bubble.
Quote from: David Kenny on December 08, 2011, 01:18:12 PM
Quote from: Richard Kelly on December 08, 2011, 01:00:45 AM
Now, just how do you get a tooltip to pop up programmatically when the mouse cursor is somewhere else?
What types of situations would you want that Richard?
I've got several background threads running doing different things that I was thinking a tooltip might be handy for.
Rick Kelly
You can try SetCursorPos to move the cursor over the control that displays the tooltip.
You could have a button control with a transparent background and no foreground or border, that you enable, then move to the current cursor position. That way you don't have to move the cursor and the tooltip will pop up near the cursor where the user left it. Again, we are left speculating what would work best for you as your description about you are thinking of doing is still a little vague. You could always draw it yourself... anywhere you want it.
David
TTM_WINDOWFROMPOINT looks like the closest thing. TTM_RELAYEVENT also could be useful. There are also some advanced things you can do with tooltips that have Close(X) buttons and mouse click messages too. An old Nero Ultra I used to use did some interesting things with them too that most likely required subclassing to behave the way they did.