Page 1 of 1

Tooltips not working/showing for gadgets inside a frame?

Posted: Sun Dec 01, 2024 10:27 am
by Nudgy
Hi,

Does anyone know how I can get tooltips to display even if the gadget with the tooltip (e.g. a button) is inside a frame?

Example: If I create a simple form with a button that has a tooltip, the tooltip will display just fine. If I then add a separate frame with a button inside, and that button has a tooltip, this 2nd tooltip does not show for the new button. For the 1st button outside the frame, the tooltip will still work.

In case it makes a difference, I am running Linux.

Thanks,
Nudgy

Re: Tooltips not working/showing for gadgets inside a frame?

Posted: Sun Dec 01, 2024 11:15 am
by TI-994A
Nudgy wrote: Sun Dec 01, 2024 10:27 am...frame with a button inside, and that button has a tooltip, this 2nd tooltip does not show for the new button..

Hi @Nudgy. It should work if the frame has the container flag applied:

Code: Select all

FrameGadget(0, 10, 10, 200, 100, "Frame", #PB_Frame_Container)

Tested and working on Ubuntu 24.10 with PureBasic v6.12.

Re: Tooltips not working/showing for gadgets inside a frame?

Posted: Sun Dec 01, 2024 11:19 am
by mk-soft
Looks like a bug.
If you create the frame later it works.

Code: Select all

;-TOP

Procedure UpdateWindow()
  Protected dx, dy
  dx = WindowWidth(0)
  dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
  ; Resize Gadgets
  ResizeGadget(0, 10, 10, dx - 20, dy - 20)
EndProcedure

Procedure Main()
  Protected dx, dy
  
  #WinStyle = #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget
  
  If OpenWindow(0, #PB_Ignore, #PB_Ignore, 600, 400, "Test Window", #WinStyle)
    ; MenuBar
    CreateMenu(0, WindowID(0))
    MenuTitle("&File")
    MenuItem(99, "E&xit")
    
    ; StatusBar
    CreateStatusBar(0, WindowID(0))
    AddStatusBarField(#PB_Ignore)
    
    ; Gadgets
    dx = WindowWidth(0)
    dy = WindowHeight(0) - StatusBarHeight(0) - MenuHeight()
    ;FrameGadget(0, 10, 10, dx - 20, dy -20, " Frame ", #PB_Frame_Container) ; <- ToolTip work
    ;FrameGadget(0, 10, 10, dx - 20, dy -20, " Frame ") ; <- ToolTip not work
    ButtonGadget(1, 20, 30, 120, 25, "Button 1")
    GadgetToolTip(1, "This is a button")
    ;CloseGadgetList()
    FrameGadget(0, 10, 10, dx - 20, dy -20, " Frame ") ; <- ToolTip work
    
    ; Bind Events
    BindEvent(#PB_Event_SizeWindow, @UpdateWindow(), 0)
    
    ; Main Loop
    Repeat
      Select WaitWindowEvent()
        Case #PB_Event_CloseWindow
          Select EventWindow()
            Case 0
              Break
          EndSelect
          
        Case #PB_Event_Menu
          Select EventMenu()
            Case 99
              PostEvent(#PB_Event_CloseWindow, 0, 0)
              
          EndSelect
          
        Case #PB_Event_Gadget
          Select EventGadget()
              
          EndSelect
          
      EndSelect
    ForEver
    
  EndIf
  
EndProcedure : Main()

Re: Tooltips not working/showing for gadgets inside a frame?

Posted: Sun Dec 01, 2024 11:50 am
by Nudgy
Thanks to both of you for your quick replies.

#PB_Frame_Container could be a temporary fix, but since I am mostly editing the form with the standard GUI form editor and that removes such custom edits/flags, I guess that I will have to keep my fingers crossed that the issue will be fixed in a future update.

Edit: Moving the frame creation code to the end as suggested by mksoft also seems to work and won't be modified by the GUI form editor.

Re: Tooltips not working/showing for gadgets inside a frame?

Posted: Sun Dec 01, 2024 11:58 am
by mk-soft
Create bug report ...
Link: viewtopic.php?t=85821

Re: Tooltips not working/showing for gadgets inside a frame?

Posted: Sun Dec 01, 2024 5:39 pm
by TI-994A
Nudgy wrote: Sun Dec 01, 2024 11:50 am...#PB_Frame_Container could be a temporary fix, but since I am mostly editing the form with the standard GUI form editor and that removes such custom edits/flags...
Yes. The frame gadget is originally meant for UI aesthetics. Changing it to a container would really mess up the positioning of the "containing" gadgets. :lol: