Page 1 of 1

PB v6.xx ToolTip and FrameGadget

Posted: Sun Dec 01, 2024 11:57 am
by mk-soft
Tooltip of gadgets not work inside frame gadget

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: PB v6.xx ToolTip and FrameGadget

Posted: Fri Jan 17, 2025 3:01 pm
by Fred
That's why the container flag has been added, the FrameGadget() should always been used as a container from now on.