Increase display time of tooltip?
-
- Enthusiast
- Posts: 443
- Joined: Sun Apr 06, 2008 12:54 pm
- Location: Brisbane, Qld, Australia
- Contact:
Increase display time of tooltip?
Some of my tooltips are fairly long and by the time I've read two thirds of the way through, the tootip disappears. Is there a way to increase the time a tooltip is displayed, other than by coding my own tooltip window etc?
Re: Increase display time of tooltip?
Hi
Code: Select all
If OpenWindow(0, 0, 0, 270, 100, "GadgetTooltip", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 80, 30, "Button 1")
GadgetToolTip(0, "Tooltip for Button 1"+#CR$+"with MultiLine for GG")
ttip = FindWindow_("tooltips_class32",0)
ButtonGadget(1, 10, 50, 80, 30, "Button 2")
GadgetToolTip(1, "Tooltip for Button 2"+#CR$+"with adding new functions")
If ttip
SendMessage_(ttip,#TTM_SETDELAYTIME,#TTDT_INITIAL,0)
SendMessage_(ttip,#TTM_SETDELAYTIME,#TTDT_AUTOPOP,30000) ;30000 is the highest value
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Egypt my love
-
- Enthusiast
- Posts: 443
- Joined: Sun Apr 06, 2008 12:54 pm
- Location: Brisbane, Qld, Australia
- Contact:
Re: Increase display time of tooltip?
Many thanks, RASHAD, that's great! 
Just one change: I didn't know I could get multiline tooltips, but just adding the #CR$ didn't give me a multiline tooltip (using PB 5.00 x86). So I searched the Forum for info on this and found that by adding "SendMessage_(ttip,#TTM_SETMAXTIPWIDTH,0,500)" then the multiline feature is implemented. I chose '500' as the maximum width just to make sure the width is greater than the text width of the longest line.
So here is the slightly modified code:

Just one change: I didn't know I could get multiline tooltips, but just adding the #CR$ didn't give me a multiline tooltip (using PB 5.00 x86). So I searched the Forum for info on this and found that by adding "SendMessage_(ttip,#TTM_SETMAXTIPWIDTH,0,500)" then the multiline feature is implemented. I chose '500' as the maximum width just to make sure the width is greater than the text width of the longest line.
So here is the slightly modified code:
Code: Select all
If OpenWindow(0, 0, 0, 270, 100, "GadgetTooltip", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 80, 30, "Button 1")
GadgetToolTip(0, "Tooltip for Button 1"+#CR$+"with MultiLine for GG")
ttip = FindWindow_("tooltips_class32",0)
ButtonGadget(1, 10, 50, 80, 30, "Button 2")
GadgetToolTip(1, "Tooltip for Button 2"+#CR$+"with adding new functions")
If ttip
SendMessage_(ttip,#TTM_SETMAXTIPWIDTH,0,500)
SendMessage_(ttip,#TTM_SETDELAYTIME,#TTDT_INITIAL,0)
SendMessage_(ttip,#TTM_SETDELAYTIME,#TTDT_AUTOPOP,30000) ;30000 is the highest value
EndIf
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Re: Increase display time of tooltip?
Hi,
... Can I ask a question of someone who knows more about tooltips than I (not too hard)
. How can tooltips be switched ON and OFF globally thoughout a program? The context is that while learning a new program verbose tooltips can be useful, later they can be a nuisance.
Regards,
RichardL
... Can I ask a question of someone who knows more about tooltips than I (not too hard)

Regards,
RichardL
Re: Increase display time of tooltip?
Hi
Code: Select all
Global Dim hTip(3),Dim hIcon(3)
Global Balloon.TOOLINFO
Procedure BalloonTip(tipn,GadgetID, Gadget,FontID,Title$,Text$, hIcon)
hTip(tipn) = CreateWindowEx_(0,"ToolTips_Class32","",#WS_POPUP | #TTS_NOPREFIX | #TTS_BALLOON,0,0,0,0,GadgetID,0,GetModuleHandle_(0),0)
SetWindowTheme_(hTip(tipn), @null.w, @null.w)
SendMessage_(hTip(tipn),#WM_SETFONT,FontID,0)
SendMessage_(hTip(tipn),#TTM_SETTIPTEXTCOLOR,$0202FD,0)
SendMessage_(hTip(tipn),#TTM_SETTIPBKCOLOR,$DCFFFF,0)
Balloon\cbSize=SizeOf(Balloon)
Balloon\uFlags=#TTF_IDISHWND | #TTF_SUBCLASS
Balloon\hWnd=GadgetID(Gadget)
Balloon\uId=GadgetID(Gadget)
Balloon\lpszText=@Text$
SendMessage_(hTip(tipn), #TTM_ADDTOOL, 0, Balloon)
SendMessage_(hTip(tipn), #TTM_SETTITLE, hIcon, @Title$)
EndProcedure
OpenWindow(0, 235, 2, 400, 200, "ToolTip Test", #PB_Window_SystemMenu | #PB_Window_TitleBar|#PB_Window_ScreenCentered )
ButtonGadget(1, 10, 160, 80, 25, "TEST 1")
BalloonTip(1,GadgetID(1), 1,FontID1,"Hi","This is a test for"+#CRLF$+"Multiline Balloon",hIcon(1))
ButtonGadget(2, 100, 160, 80, 25, "TEST 2")
BalloonTip(2,GadgetID(2), 2,FontID2,"NEXT","OK",hIcon(2))
ButtonGadget(3, 190, 160, 120, 25, "Toggle ToolTip # 1")
act = 1
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 3
act ! 1
SendMessage_(hTip(1), #TTM_ACTIVATE, act,0)
EndSelect
EndSelect
Until Quit = 1
End
Egypt my love