Page 1 of 1

5.11 ToolBar and StatusBar disappears

Posted: Fri May 24, 2013 7:27 am
by storck
Hi all,

I am trying a simple window design. It has a Menu, ToolBar, StausBar and a Panel. When running this the StatusBar and the MenuBar are missing. Is it a known problem? Any workaround?

Regards,

Storck

Re: 5.11 ToolBar and StatusBar disappears

Posted: Fri May 24, 2013 8:04 am
by TI-994A
storck wrote:It has a Menu, ToolBar, StausBar and a Panel. When running this the StatusBar and the MenuBar are missing. Is it a known problem? Any workaround?
Hi storck. There doesn't seem to be any known issues with PureBasic's gadgets. It could be an overlap problem, and either the Panel or ToolBar may be blocking the Menu and StatusBar. Perhaps if you posted the code snippet, we could take a look.

Re: 5.11 ToolBar and StatusBar disappears

Posted: Fri May 24, 2013 8:30 am
by storck
This is the window design
Image

Looks like this when run
Image

This is the generated code

Code: Select all

Global Window_0

Global Panel_0

Enumeration #PB_Compiler_EnumerationValue
  #MenuItem_2
EndEnumeration

Declare ResizeGadgetsWindow_0()


Procedure OpenWindow_0()
  Window_0 = OpenWindow(#PB_Any, 0, 0, 660, 510, "TestWindow", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
  CreateMenu(0, WindowID(Window_0))
  MenuTitle("File")
  MenuItem(#MenuItem_2, "Exit")
  Panel_0 = PanelGadget(#PB_Any, 0, 0, 660, 443)
  AddGadgetItem(Panel_0, -1, "Tab 1")
  CloseGadgetList()
EndProcedure

Procedure ResizeGadgetsWindow_0()
  Protected WindowWidth, WindowHeight
  WindowWidth = WindowWidth(Window_0)
  WindowHeight = WindowHeight(Window_0)
  ResizeGadget(Panel_0, 0, 0, WindowWidth - 0, WindowHeight - MenuHeight() - 0)
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_SizeWindow
      ResizeGadgetsWindow_0()
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
        Case #MenuItem_2
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

Re: 5.11 ToolBar and StatusBar disappears

Posted: Fri May 24, 2013 9:15 am
by TI-994A
storck wrote:

Code: Select all

Procedure OpenWindow_0()
  Window_0 = OpenWindow(#PB_Any, 0, 0, 660, 510, "TestWindow", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
  CreateMenu(0, WindowID(Window_0))
  MenuTitle("File")
  MenuItem(#MenuItem_2, "Exit")
  Panel_0 = PanelGadget(#PB_Any, 0, 0, 660, 443)
  AddGadgetItem(Panel_0, -1, "Tab 1")
  CloseGadgetList()
EndProcedure
Hello again storck. Looking at the window code above, you'll notice that the ToolBar and StatusBar have not been initialised. Although you may have provisioned them in the Visual Designer, they will only be initialised once elements are added to them. From your screenshot, it looks like you've not done that. Try by adding a button to the ToolBar and a label to the StatusBar, and their code will be generated, and then they should appear on the program form.

Re: 5.11 ToolBar and StatusBar disappears

Posted: Fri May 24, 2013 9:24 am
by storck
Hi,

Thank U! I am in the bad habit of test compiling everything as I go... Since using Delphi and C++ Builder I am used to not having to put anything in the statusbar or toolbar until later. Anyways, thank you for pointing this out. Now I can go on with the project knowing that it will work.

Best Regards,

Storck