Nexus -library of custom gadgets (32-bit / 64-bit)
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
SRod: I know it was a pain before - having some extra lines in your source to cope with combobox problems with nxSplitter. but now you have changed the source ( If blnNewlyCreated ), it fits in ok - see this:
I've just added ' Or GadgetType(*nx\gad1)=#PB_GadgetType_ComboBox' to 4 of the conditions. This way there are no redraw problems with comboboxes.
Will you be able to keep this new version in yor source?
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
Will you be able to keep this new version in yor source?

https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
Well either way there are still problems with the combo in a splitter. Even PB's splitter seems to have real redrawing problems now with combos!
Using ResizeGadget() with a combo fails if you try to proceed beyond a certain minimum. Try it, try anchoring the splitter so that a combo is collapsed completely and you will see what I mean.
Then again, MoveWindow_() suffers it's own problems with combo's. I should really use the #CB_SETITEMHEIGHT message but I am not prepared to start throwing in code to deal with individual gadgets etc.
With or without ResizeGadget(), the only way that I can find of getting a combo to behave is to also set a minimum size for the splitter to ensure that the combo is not resized beyond it's apparent minimum. Otherwise, all hell can break loose!
Nevertheless, I will include your modifications in the next update. Thanks.
**EDIT : just out of interest can you try the following to see if a PB splitter misbehaves with combos on your system?
Using ResizeGadget() with a combo fails if you try to proceed beyond a certain minimum. Try it, try anchoring the splitter so that a combo is collapsed completely and you will see what I mean.
Then again, MoveWindow_() suffers it's own problems with combo's. I should really use the #CB_SETITEMHEIGHT message but I am not prepared to start throwing in code to deal with individual gadgets etc.
With or without ResizeGadget(), the only way that I can find of getting a combo to behave is to also set a minimum size for the splitter to ensure that the combo is not resized beyond it's apparent minimum. Otherwise, all hell can break loose!

Nevertheless, I will include your modifications in the next update. Thanks.
**EDIT : just out of interest can you try the following to see if a PB splitter misbehaves with combos on your system?
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
I may look like a mule, but I'm not a complete ass.
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
It works fine here. I tried making both the bottom and top gadgets as small as can be, both resized ok afterwards.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Vista x64 Ultimate PB4.3 x86 version
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
Hi srod,
i use nexus for few days.
I have some redraw troubles with a ScrollAreaGadget inside a nxSplitter.
I've filled up the scrollareagadegt with imagegadget only (even if it display text).
I try many ways to redraw correctly the scrollareagadget but the only way i found is to hide the scrollareagadget and then to show it, forcing it to redraw (i try updatewidow_(), Invalisaterect_(), redrawWindow_() bit without succes).
I put the Hidegadget inside your procedure nxSplitter_mainCallback(), event #WM_LBUTTONUP, once for vertical splitter and once for horizontal one.
By this way, the scrollarea is redrawn.
and
Here is the problem, the inner size is not redraw but the nonclient area background is erased.
Could you help me if possible, because i dont like the way i used.

i use nexus for few days.
I have some redraw troubles with a ScrollAreaGadget inside a nxSplitter.
I've filled up the scrollareagadegt with imagegadget only (even if it display text).
I try many ways to redraw correctly the scrollareagadget but the only way i found is to hide the scrollareagadget and then to show it, forcing it to redraw (i try updatewidow_(), Invalisaterect_(), redrawWindow_() bit without succes).
I put the Hidegadget inside your procedure nxSplitter_mainCallback(), event #WM_LBUTTONUP, once for vertical splitter and once for horizontal one.
By this way, the scrollarea is redrawn.
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
Could you help me if possible, because i dont like the way i used.

Last edited by Denis on Wed Mar 25, 2009 6:09 am, edited 1 time in total.
A+
Denis
Denis
I don't know, I use scrollareas inside nxSplitters all the time and have had no problems.
Can you reproduce the problem with some code I can run?
I have massively updated the splitter control but haven't as yet released an update.
**EDIT : nope, I cannot reproduce the problem. An image gadget inside a scrollarea inside a nxSplitter inside another nxSplitter works fine here on XP and Vista.
I'll need some code from you to see the problem myself.
****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.
Can you reproduce the problem with some code I can run?
I have massively updated the splitter control but haven't as yet released an update.
**EDIT : nope, I cannot reproduce the problem. An image gadget inside a scrollarea inside a nxSplitter inside another nxSplitter works fine here on XP and Vista.
I'll need some code from you to see the problem myself.
****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.
I may look like a mule, but I'm not a complete ass.
Ahh, trying to reduce flicker with the scrollarea huh?
What I normally do is take charge of all erasing with scrollareas. You have two windows attached to a scrollarea; the main scrollarea itself and the inner-container which actually holds the child controls. On some occasions (when the inner container is always bigger than the client area of the scrollarea) I remove all erasing from the scroll-area. On other occasions, I will erase just those parts of the scrollarea which are not occupied by the inner-container (when this inner-container is smaller than the client area etc.) On yet other occasions you can remove all erasing from both windows.
The point is that reducing flicker with a scrollarea is usually quite straight-forward. You might want to try my SmartErase utility (Tips&Tricks) which might help? As you've discovered, using #WS_CLIPCHILDREN can cause more problems than it solves!

What I normally do is take charge of all erasing with scrollareas. You have two windows attached to a scrollarea; the main scrollarea itself and the inner-container which actually holds the child controls. On some occasions (when the inner container is always bigger than the client area of the scrollarea) I remove all erasing from the scroll-area. On other occasions, I will erase just those parts of the scrollarea which are not occupied by the inner-container (when this inner-container is smaller than the client area etc.) On yet other occasions you can remove all erasing from both windows.
The point is that reducing flicker with a scrollarea is usually quite straight-forward. You might want to try my SmartErase utility (Tips&Tricks) which might help? As you've discovered, using #WS_CLIPCHILDREN can cause more problems than it solves!

I may look like a mule, but I'm not a complete ass.