Page 1 of 1

MDI and Splittergadget crashes

Posted: Mon Nov 23, 2009 7:53 pm
by Amnesty
Hello,

when I am using MDI Gadget in combination wit a Splittergadget it looks fine, but when maximizing it crashes with an invalid memory access.

The combination of MDI and Splitter is very common and useful in business software but am I doing something wrong or is it a bug ?

Can anybody help, thank you in advance

amnesty

Code: Select all

  #Main = 0
  #MDIChild = 1
  If OpenWindow(#Main, 0, 0, 640, 480, "MDIGadget", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
    If CreateMenu(#Main, WindowID(#Main))
      MenuTitle("Menu index 0")
      MenuTitle("MDI windows menu")
        MenuItem(0, "self created item")
        MenuItem(1, "self created item")
        
      MDIGadget(2, 200, 0, 200, 300, 1, 2)
        AddGadgetItem(2, #MDIChild, "Child-Fenster")
          ; add gadgets here...
      UseGadgetList(WindowID(#Main)) 
      TreeGadget(0, 0, 0, 200, 300)                                        
      For a = 0 To 10
        AddGadgetItem (0, -1, "Normal Item "+Str(a), 0, 0) 
        AddGadgetItem (0, -1, "Node "+Str(a), 0, 0)       
        AddGadgetItem(0, -1, "Sub-Item 1", 0, 1)     
        AddGadgetItem(0, -1, "Sub-Item 2", 0, 1)
        AddGadgetItem(0, -1, "Sub-Item 3", 0, 1)
        AddGadgetItem(0, -1, "Sub-Item 4", 0, 1)
        AddGadgetItem (0, -1, "File "+Str(a), 0, 0) 
      Next
    SplitterGadget(99, 0, 0, 640, 480, 0, 2,#PB_Splitter_Vertical    )
    EndIf
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
  EndIf

Re: MDI and Splittergadget crashes

Posted: Mon Nov 23, 2009 9:03 pm
by Arctic Fox
From the help manual
Additional notes:
Because of the connection with the window menu, there can only be one MDIGadget() on a window, however you can put another one in a second window if you wish. You can only put this gadget directly on a window, you can NOT put it inside a ContainerGadget(), SplitterGadget() or PanelGadget().
As the whole point of this gadget is to dynamically display data, it is recommended to use the #PB_Any feature to populate a child window with gadgets.

Re: MDI and Splittergadget crashes

Posted: Tue Nov 24, 2009 5:56 pm
by Amnesty
Thanks, I havent seen this.