PlanetSquires Forums

Support Forums => General Board => Topic started by: Richard Kelly on December 07, 2011, 08:37:59 AM

Title: Tooltips the Jose Way
Post by: Richard Kelly on December 07, 2011, 08:37:59 AM
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
Title: Re: Tooltips the Jose Way
Post by: José Roca on December 07, 2011, 10:25:24 AM
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)

Title: Re: Tooltips the Jose Way
Post by: Rolf Brandt on December 07, 2011, 10:56:45 AM
Excellent!
Title: Re: Tooltips the Jose Way
Post by: Richard Kelly on December 08, 2011, 01:00:45 AM
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
Title: Re: Tooltips the Jose Way
Post by: José Roca on December 08, 2011, 01:38:06 AM
You can't. They are designed to pop up when the user pauses the mouse pointer over a UI element.
Title: Re: Tooltips the Jose Way
Post by: 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?
Title: Re: Tooltips the Jose Way
Post by: Haakon Birkeland on December 08, 2011, 06:29:03 PM
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.
Title: Re: Tooltips the Jose Way
Post by: Richard Kelly on December 08, 2011, 11:46:45 PM
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
Title: Re: Tooltips the Jose Way
Post by: José Roca on December 09, 2011, 01:00:31 AM
You can try SetCursorPos to move the cursor over the control that displays the tooltip.
Title: Re: Tooltips the Jose Way
Post by: David Kenny on December 09, 2011, 04:12:14 AM
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
Title: Re: Tooltips the Jose Way
Post by: Roger Garstang on December 16, 2011, 05:44:29 PM
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.