Posted: Tue Mar 03, 2009 2:14 pm
Make sure you are using the version of Nexus for PB 4.3 and not the one for PB 4.2.
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
;The following procedure positions and resizes the child gadgets following a resize etc.
Procedure nxSplitter_PositionGadgets(*nx._nxsplitter, blnNewlyCreated=#False)
Protected rc.rect, hWnd, width, height
; If nxSplitter_IsChildGadget(*nx, *nx\gad1) And nxSplitter_IsChildGadget(*nx, *nx\gad2) ;Just to be safe.
hWnd = GadgetID(*nx\ctrlID)
GetClientRect_(hWnd, rc)
If *nx\styles&#nxSplitter_Vertical
width = *nx\splitterPos-#_nxsplitter_margin
If width < 0 : width = 0 : EndIf
If nxSplitter_IsChildGadget(*nx, *nx\gad1)
If blnNewlyCreated Or GadgetType(*nx\gad1)=#PB_GadgetType_ComboBox
ResizeGadget(*nx\gad1, 0, 0, width, rc\bottom)
Else
MoveWindow_(GadgetID(*nx\gad1), 0, 0, width, rc\bottom,0)
EndIf
EndIf
width = rc\right - *nx\splitterPos - #_nxsplitter_margin - *nx\sliderWidth
If width < 0 : width = 0 : EndIf
If nxSplitter_IsChildGadget(*nx, *nx\gad2)
If blnNewlyCreated Or GadgetType(*nx\gad2)=#PB_GadgetType_ComboBox
ResizeGadget(*nx\gad2, *nx\splitterPos+#_nxsplitter_margin+*nx\sliderWidth, 0, width, rc\bottom)
Else
MoveWindow_(GadgetID(*nx\gad2), *nx\splitterPos+#_nxsplitter_margin+*nx\sliderWidth, 0, width, rc\bottom,0)
EndIf
EndIf
Else
height = *nx\splitterPos-#_nxsplitter_margin
If height < 0 : height = 0 : EndIf
If nxSplitter_IsChildGadget(*nx, *nx\gad1)
If blnNewlyCreated Or GadgetType(*nx\gad1)=#PB_GadgetType_ComboBox
ResizeGadget(*nx\gad1, 0, 0, rc\right, height)
Else
MoveWindow_(GadgetID(*nx\gad1), 0, 0, rc\right, height, 0)
EndIf
EndIf
height = rc\bottom - *nx\splitterPos - #_nxsplitter_margin - *nx\sliderWidth
If height < 0 : height = 0 : EndIf
If nxSplitter_IsChildGadget(*nx, *nx\gad2)
If blnNewlyCreated Or GadgetType(*nx\gad2)=#PB_GadgetType_ComboBox
ResizeGadget(*nx\gad2, 0, *nx\splitterPos+#_nxsplitter_margin+*nx\sliderWidth, rc\right, height)
Else
MoveWindow_(GadgetID(*nx\gad2), 0, *nx\splitterPos+#_nxsplitter_margin+*nx\sliderWidth, rc\right, height, 0)
EndIf
EndIf
EndIf
; EndIf
EndProcedure
Code: Select all
If OpenWindow(0, 0, 0, 230, 180, "SplitterGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
#Button1 = 0
#Button2 = 1
#Splitter = 2
ComboBoxGadget(#Button1, 0, 0, 0, 0)
ComboBoxGadget(#Button2, 0, 0, 0, 0)
SplitterGadget(#Splitter, 5, 5, 220, 120, #Button1, #Button2, #PB_Splitter_Separator)
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
perfect! Now it works as expectedsrod wrote:A bug with the nxSplitter control when housing Purebasic panel gadgets has been fixed.
Code: Select all
ElseIf gnxSplitterDrag\sliderMoved
If *nx\blnAnchored
;Send a #nxSplitter_AnchorReleased message to the users callback.
nxSplitter_DespatchCallbackMessage(*nx\ctrlID, #nxSplitter_AnchorReleased, 3-*nx\gadgetToCollapse, 0)
EndIf
*nx\blnAnchored = #False
pos = lParam&$ffff - gnxSplitterDrag\offset
If pos-#_nxsplitter_margin<*nx\gad1Min
pos = *nx\gad1Min+#_nxsplitter_margin
ElseIf gnxSplitterDrag\clientSize - pos - *nx\sliderWidth - #_nxsplitter_margin < *nx\gad2Min
pos = gnxSplitterDrag\clientSize - *nx\gad2Min - *nx\sliderWidth - #_nxsplitter_margin
EndIf
If nxSplitter_SetSplitterPos(*nx, pos,1) = 0
InvalidateRect_(hWnd, 0, 1)
EndIf
; <-- Here is my code
If GadgetType(*nx\gad2)= #PB_GadgetType_ScrollArea
HideGadget(*nx\gad2, 1)
HideGadget(*nx\gad2, 0)
EndIf
; <-- Here is the end
EndIf
Code: Select all
ElseIf gnxSplitterDrag\sliderMoved
If *nx\blnAnchored
;Send a #nxSplitter_AnchorReleased message to the users callback.
nxSplitter_DespatchCallbackMessage(*nx\ctrlID, #nxSplitter_AnchorReleased, 3-*nx\gadgetToCollapse, 0)
EndIf
*nx\blnAnchored = #False
pos = (lParam>>16)&$ffff - gnxSplitterDrag\offset
If pos-#_nxsplitter_margin<*nx\gad1Min
pos = *nx\gad1Min+#_nxsplitter_margin
ElseIf gnxSplitterDrag\clientSize - pos - *nx\sliderWidth - #_nxsplitter_margin < *nx\gad2Min
pos = gnxSplitterDrag\clientSize - *nx\gad2Min - *nx\sliderWidth - #_nxsplitter_margin
EndIf
If nxSplitter_SetSplitterPos(*nx, pos,1) = 0
InvalidateRect_(hWnd, 0, 1)
EndIf
; <-- Here is my code
; If GadgetType(*nx\gad2)= #PB_GadgetType_ScrollArea
HideGadget(*nx\gad2, 1)
HideGadget(*nx\gad2, 0)
; EndIf
; <-- Here is the end
EndIf
You're right, i've removed this style and now it's OKsrod wrote: ****EDIT : have you set the #WS_CLIPCHILDREN style for the scrollarea? If you have then this could certainly lead to the kind of problems you describe.