Page 2 of 2

Re: [SUPERIOR!!] (Windows) Mouse Over Gadget BalloonTips

Posted: Tue Feb 24, 2026 5:59 am
by Randy Walker
Little_man wrote: Mon Feb 23, 2026 9:27 am Is it possible to scale “Tooltip”:

I scaled an “OpenWindow”, after scaling I get the values “ScaleX” and “ScaleY”
(I would like to use several “Tooltips” on the “Openwindow”.)

I would like to scale the “Tooltips” in size and the “Font Height” and be visible for maximum time,
change the fontstyle of the Tooltip to Italic or Normal when running the program.

Little_man
Sorry Little_man, I doubt it is possible.

Re: [SUPERIOR!!] (Windows) Mouse Over Gadget BalloonTips

Posted: Tue Feb 24, 2026 6:23 pm
by Little_man
Possible solution to the above problem !!..

Still to do:
Change the Tooltip font to "Italic or Normal" when the program is running.

Code: Select all

EnableExplicit

;Configuration & Variables.
Global.f Temp_ScaleX = 1        ;The scale factor (e.g. 100%).
Global TipTime = 150

Global.i FontID

;Initialiseer Font.
FontID = LoadFont(0, "Segoe UI", 9 * Temp_ScaleX, #PB_Font_Italic)

Procedure ShowScaledBalloonTip(Gadget, Text$, Title$, Icon = #TOOLTIP_INFO_ICON)
  Protected Handle  = GadgetID(Gadget)
  Protected Tooltip = CreateWindowEx_(0, "tooltips_class32", "", #WS_POPUP, 0, 0, 0, 0, 0, 0, 0, 0)

  ;1. Set the scale for the font.
  SendMessage_(Tooltip, #WM_SETFONT, FontID, #True)
  
  ;2. Configure the Tooltip Tool info.
  Protected Ti.TOOLINFO
  Ti\cbSize   = SizeOf(TOOLINFO)
  Ti\uFlags   = #TTF_SUBCLASS | #TTF_IDISHWND
  Ti\hwnd     = WindowID(0)
  Ti\uId      = Handle
  Ti\lpszText = @Text$

  ;3a. Add the tool and set the title/icon.
  SendMessage_(Tooltip, #TTM_ADDTOOL, 0, @Ti)
  ;SendMessage_(Tooltip, #TTM_SETTITLE, Icon, @Title$)          ;"InformatiON"+":".
  
  ;3b. Show Tooltip Time.
  SendMessage_(Tooltip, #TTM_SETDELAYTIME, 0, TipTime)

  ;4. Optional: Scaling margins (ensures the balloon grows).
  Protected Rect.RECT
  Rect\left  = 10 * Temp_ScaleX: Rect\top    = 5 * Temp_ScaleX
  Rect\right = 10 * Temp_ScaleX: Rect\bottom = 5 * Temp_ScaleX
  SendMessage_(Tooltip, #TTM_SETMARGIN, 0, @Rect)
  
  ;Set Maximum Width (Forces wrapping and proper scaling).
  SendMessage_(Tooltip, #TTM_SETMAXTIPWIDTH, 0, 600 * Temp_ScaleX)
EndProcedure

;GUI.
If OpenWindow(0, 100, 100, 170 * Temp_ScaleX, 200 * Temp_ScaleX, "Geschaalde BalloonTip", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
  
  ButtonGadget(1, 10 * Temp_ScaleX, 10 * Temp_ScaleX, 150 * Temp_ScaleX, 25 * Temp_ScaleX, "Hover over mij!")
  ButtonGadget(2, 10 * Temp_ScaleX, 40 * Temp_ScaleX, 150 * Temp_ScaleX, 25 * Temp_ScaleX, "Hover over mij!")
  ButtonGadget(3, 10 * Temp_ScaleX, 70 * Temp_ScaleX, 150 * Temp_ScaleX, 25 * Temp_ScaleX, "Hover over mij!")
  
  ;Pas de tooltip toe.
  ShowScaledBalloonTip(1, Space(3) + "Karakters welke" + " " + Chr(34) + "NIET" + Chr(34) + " " + "toegestaan zijn bij invoer van de " + Chr(34) +
                          "Bestandsnaam" + Chr(34) + ":   " + #CRLF$ + Space(10) + "[    " + ". \ / : * ? " + Chr(34) + " < > |" + "    ]", "Informatie"+":")
  
  ShowScaledBalloonTip(2, Space(3) + "Karakters welke" + " " + Chr(34) + "NIET" + Chr(34) + " " + "toegestaan zijn bij invoer van de " + Chr(34) +
                          "Bestandsnaam" + Chr(34) + ":   " + #CRLF$ + Space(10) + "[    " + ". \ / : * ? " + Chr(34) + " < > |" + "    ]", "Informatie"+":")
  
  ShowScaledBalloonTip(3, Space(3) + "Karakters welke" + " " + Chr(34) + "NIET" + Chr(34) + " " + "toegestaan zijn bij invoer van de " + Chr(34) +
                          "Bestandsnaam" + Chr(34) + ":   " + #CRLF$ + Space(10) + "[    " + ". \ / : * ? " + Chr(34) + " < > |" + "    ]", "Informatie"+":")
  
  Repeat: Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Little_man