Page 1 of 1
Splittergadget and panels..
Posted: Sun Feb 26, 2006 11:13 pm
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

Posted: Mon Feb 27, 2006 12:09 am
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
Posted: Mon Feb 27, 2006 6:15 pm
by thefool
bump

Posted: Mon Feb 27, 2006 7:38 pm
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
Posted: Mon Feb 27, 2006 7:40 pm
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

Posted: Mon Feb 27, 2006 7:49 pm
by Sparkie
Just converted and ran thefool's original code to PB 3.94 and no problem there.

Posted: Mon Feb 27, 2006 7:51 pm
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 :/
Posted: Mon Feb 27, 2006 7:56 pm
by blueznl
you should be happy

as then it's a bug! joohooo freeeeed!

Posted: Mon Feb 27, 2006 8:00 pm
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
Posted: Mon Feb 27, 2006 8:04 pm
by thefool
Thanks for looking into this
Also confirmed sparkie's result under windows XP using 3.94. Bug report posted
