Page 10 of 13

Posted: Tue Mar 03, 2009 2:14 pm
by srod
Make sure you are using the version of Nexus for PB 4.3 and not the one for PB 4.2.

Posted: Tue Mar 03, 2009 2:40 pm
by jpd
Hi,

@gnozal thanks this help ..

If PtInRect_(@rcScreen,PInfo\pt\y<<32+PInfo\pt\x)

@SROD

I'm sorry I have download the false Version :oops:

...
the only change in 4.20 Version to 4.30 is the line that I have change manually??

Thanks

jpd

Posted: Sun Mar 08, 2009 11:23 am
by DoubleDutch
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:

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
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? :)

Posted: Sun Mar 08, 2009 12:14 pm
by srod
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?

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

Posted: Sun Mar 08, 2009 12:24 pm
by DoubleDutch
It works fine here. I tried making both the bottom and top gadgets as small as can be, both resized ok afterwards.

Posted: Sun Mar 08, 2009 12:28 pm
by srod
Yes, I swear it used to work fine here; but doesn't anymore! That is weird.

Posted: Sun Mar 08, 2009 12:47 pm
by srod
@Anthony, I just asked fangles to test that code and he reports the same problems. Are you using PB 4.3? Which OS version?

Posted: Sun Mar 08, 2009 2:13 pm
by DoubleDutch
Vista x64 Ultimate PB4.3 x86 version

Posted: Wed Mar 11, 2009 11:22 am
by srod
nxSplitter controls.
A bug with the nxSplitter control when housing Purebasic panel gadgets has been fixed.

Thanks Kiffi.

(Only the Purebasic 4.3 version of Nexus has had this bug fix applied. The PB 4.2 version is no longer supported.)

Regards.

Posted: Wed Mar 11, 2009 11:37 am
by Kiffi
srod wrote:A bug with the nxSplitter control when housing Purebasic panel gadgets has been fixed.
perfect! Now it works as expected :D

Thanks & Greetings ... Kiffi

Posted: Tue Mar 24, 2009 7:59 pm
by Denis
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.

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
and

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
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.

Image

Posted: Tue Mar 24, 2009 8:16 pm
by srod
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.

Posted: Wed Mar 25, 2009 6:20 am
by Denis
Tks srod for your help.
srod 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.
You're right, i've removed this style and now it's OK :D

(good lib indeed)

Posted: Wed Mar 25, 2009 10:29 am
by srod
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! :)

Posted: Wed Mar 25, 2009 3:03 pm
by Denis
Ok srod,

i will try SmartErase soon. :D