Code: Select all
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Project name : PanelGadget-SplitterGadget Warning
; File Name : PanelGadget-SplitterGadget Warning.pb
; File version: 1.0.0
; Programming : Problem demonstration
; Programmed by : Guimauve
; Date : 24-02-2012
; Last Update : 24-02-2012
; PureBasic code : 4.61 Beta 1 x64
; Plat-form : LinuxMint12 x64 + Gnome-Shell
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Problem description :
;
; When we place a PanelGadget inside a SplitterGadget, we can't add gadget items to 
; the PanelGadget without receiving a GTK Warning :
;
; WARNING CRITICAL: clearlooks_style_draw_box_gap: assertion 'height >=-1' failed
;
; This also occur when Resize the window as small as possible. (Maybe a 
; WindowBounds() will avoid this problem but we can rely on this as a solution)
;
; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Enumeration
  
  #MainWin
  
  #Panel_Sources
  #Editor_Log
  #Splitter_Sources_Log
  
  #Panel_Tools
  #Splitter_Sources_Log_Tools
  
EndEnumeration
Procedure ResizeEditorWindow()
  
  ResizeGadget(#Splitter_Sources_Log_Tools, #PB_Ignore, #PB_Ignore, WindowWidth(#MainWin) - 10, WindowHeight(#MainWin) - 10)
  
EndProcedure
If OpenWindow(#MainWin, 50, 50, 800, 600, "Panel and Splitter", #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget)
  
  PanelGadget(#Panel_Sources, 0, 0, 0, 0)
    AddGadgetItem(#Panel_Sources, 0, "Source 1")
    AddGadgetItem(#Panel_Sources, 1, "Source 2")
  CloseGadgetList()
  
  EditorGadget(#Editor_Log, 0, 0, 0, 0, #PB_Editor_ReadOnly)
  
  SplitterGadget(#Splitter_Sources_Log, 0, 0, 0, 0, #Panel_Sources, #Editor_Log)
  
  PanelGadget(#Panel_Tools, 0, 0, 0, 0)
    AddGadgetItem(#Panel_Tools, 0, "Outil 1")
    AddGadgetItem(#Panel_Tools, 1, "Outil 2")
  CloseGadgetList()
  
  SplitterGadget(#Splitter_Sources_Log_Tools, 5, 5, WindowWidth(#MainWin)-10, WindowHeight(#MainWin)-10, #Splitter_Sources_Log, #Panel_Tools, #PB_Splitter_Vertical)
  
  ; The following code is a workaround to avoid the GTK WARNING
  ; Of course, the AddGadgetItem() above should be deleted.
  
  ;   OpenGadgetList(#Panel_Sources)
  ;     AddGadgetItem(#Panel_Sources, 0, "Source 1")
  ;     AddGadgetItem(#Panel_Sources, 1, "Source 2")
  ;   CloseGadgetList()
  ;   
  ;   OpenGadgetList(#Panel_Tools)
  ;     AddGadgetItem(#Panel_Tools, 0, "Outil 1")
  ;     AddGadgetItem(#Panel_Tools, 1, "Outil 2")
  ;   CloseGadgetList()
  SetGadgetState(#Splitter_Sources_Log, WindowHeight(#MainWin) * 0.80)
  SetGadgetState(#Splitter_Sources_Log_Tools, WindowWidth(#MainWin) * 0.85)
  
  Repeat
    
    EventID = WaitWindowEvent()
    
    Select EventID
        
      Case #PB_Event_Menu
        
        Select EventMenu()
            
        EndSelect
        
      Case #PB_Event_Gadget
        
        Select EventGadget()
            
        EndSelect
        
      Case #PB_Event_SizeWindow, #PB_Event_RestoreWindow
        ResizeEditorWindow()
        
    EndSelect
    
  Until EventID = #PB_Event_CloseWindow
  
EndIf 
; <<<<<<<<<<<<<<<<<<<<<<<
; <<<<< END OF FILE <<<<<
; <<<<<<<<<<<<<<<<<<<<<<<Guimauve





