Splittergadget and panels..

Just starting out? Need help? Post your questions and find answers here.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Splittergadget and panels..

Post by thefool »

Im writing an editor. I created a panel-gadget and a simple listview, threw on a splittergadget. Now using the #PB_Splitter_SecondFixed i fix the bottom listview..

NOW! on the panelgadget, just after the first tab, if you have your mouse there then a double arrow will show, allowing you to RESIZE!

How can i get rid of that?

Thanks in advance :)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Small example:

Code: Select all

Global Window_0
Global Panel_0
Global ListIcon_0
Global Splitter_0


Procedure Open_Window_0()
  
  
  
  Window_0 = OpenWindow(#PB_Any, 5, 5, 382, 292,  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Test")
  If Window_0
  
  
    If CreateGadgetList(WindowID(Window_0))
      Panel_0 = PanelGadget(#PB_Any, 10, 10, 380, 240)
      AddGadgetItem(Panel_0, 1, "Tab 1")
      ListIcon_0 = ListViewGadget(#PB_Any, -2, 218, 380, 50)
      CloseGadgetList()
      Splitter_0 = SplitterGadget(#PB_Any, 0, 0, 380, 280, Panel_0, ListIcon_0,#PB_Splitter_SecondFixed)
      
    EndIf
  EndIf
EndProcedure

Open_Window_0()

;Init the splitbar position
SetGadgetState(Splitter_0,206)

For i=1 To 50
AddGadgetItem(ListIcon_0,-1,"[22:52:32] Testing "+Str(i))
Next i

Repeat
  
  Event = WaitWindowEvent()
  
  WindowID = EventWindow()
  
  If event= #PB_Event_SizeWindow
  ResizeGadget(splitter_0,0,0,WindowWidth(window_0),WindowHeight(window_0)-20)
  EndIf
  
  GadgetID = EventGadget()
  
  If Event = #PB_Event_Gadget
    
  EndIf
  
Until Event = #PB_Event_CloseWindow

End
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

bump :(
blueapples
User
User
Posts: 19
Joined: Mon Oct 03, 2005 10:00 am

Post by blueapples »

As we talked about in channel (#PureBasic on freenode), this is because the mouse events are going throught the non-tab area of the PanelGadget, which in Windows is a "transparent" area.

I'm not sure what this solution would do on platforms other than Windows. Can anyone test it? I imagine it will look fine, I'm not doing anything all that odd. I suspect that the problem doesn't exist to begin with outside of Windows.

Code: Select all

Global Window_0 
Global Panel_0 
Global ListIcon_0 
Global Splitter_0 
Global Frame_0

Procedure Open_Window_0() 
  Window_0 = OpenWindow(#PB_Any, 5, 5, 382, 292,  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Test") 
  If Window_0 

    If CreateGadgetList(WindowID(Window_0))     
      
      ; All this container does is hold the panel, see the #PB_Event_SizeWindow
      ; event below
      Frame_0 = ContainerGadget(#PB_Any, 10, 10, 380, 240)
      Panel_0 = PanelGadget(#PB_Any, 0, 0, 300, 200) 
      CloseGadgetList()
      
      AddGadgetItem(Panel_0, 1, "Tab 1") 
       
      CloseGadgetList()
      
      ListIcon_0 = ListViewGadget(#PB_Any, -2, 218, 380, 50)
      Splitter_0 = SplitterGadget(#PB_Any, 0, 0, 380, 280, Frame_0, ListIcon_0, #PB_Splitter_SecondFixed) 
      
    EndIf 
  EndIf 
EndProcedure 

Open_Window_0() 

;Init the splitbar position 
SetGadgetState(Splitter_0,206) 

For i=1 To 50 
AddGadgetItem(ListIcon_0,-1,"[22:52:32] Testing "+Str(i)) 
Next i 

Repeat 
  
  Event = WaitWindowEvent() 
  
  WindowID = EventWindow() 
  
  If event= #PB_Event_SizeWindow 
    ; Since the SplitterGadget only changes the size of Frame_0, we have to
    ; change Panel_0's size to match
    ResizeGadget(Panel_0, 0, 0, GadgetWidth(Frame_0), GadgetHeight(Frame_0))
    
    ResizeGadget(splitter_0,0,0,WindowWidth(window_0),WindowHeight(window_0)-20) 
  EndIf 
  
  GadgetID = EventGadget() 
  
  If Event = #PB_Event_Gadget 
    
  EndIf 
  
Until Event = #PB_Event_CloseWindow 

End
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

thanks! Yeah adding some gadget to steal the mouse focus was also on my thoughts-list, (maybe some mouse hooking too..), this seems to work nicely though :)
Sparkie
PureBatMan Forever
PureBatMan Forever
Posts: 2307
Joined: Tue Feb 10, 2004 3:07 am
Location: Ohio, USA

Post by Sparkie »

Just converted and ran thefool's original code to PB 3.94 and no problem there. :?
What goes around comes around.

PB 5.21 LTS (x86) - Windows 8.1
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Sparkie wrote:Just converted and ran thefool's original code to PB 3.94 and no problem there. :?
Hmm so afterall it does look like some behaviour changed :/
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

you should be happy :-) as then it's a bug! joohooo freeeeed! :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
blueapples
User
User
Posts: 19
Joined: Mon Oct 03, 2005 10:00 am

Post by blueapples »

Okay I have tested both in 3.94 on Linux and two things:

* original problem is not present in thefool's original code
* in my version, GadgetWidth() and GadgetHeight() always return 1 instead of the expected width/height of the gadget
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Thanks for looking into this :)

Also confirmed sparkie's result under windows XP using 3.94. Bug report posted :)
Post Reply