Page 8 of 13

Posted: Tue Nov 25, 2008 12:44 pm
by DoubleDutch
One for full updates for life and another for 12 months access to updates
This seems ideal. You could have a TrialPay button for the 12 month system.

Posted: Mon Dec 15, 2008 10:27 pm
by DoubleDutch
Possible bug in nxSplitter when using a combobox (PB 4.3)...

Code: Select all

#INCLUDE_NEXUS_SPLITTER = 1  ;Declare this before including the Nexus source.


  XIncludeFile "nxGadgets.pbi"



;///////////////////////////////////////////////////////////////////////////////////////////
Procedure.l SplitterCallback(id, uMsg, wParam, lParam)
  Protected result = #True
  Select uMsg
    Case #nxSplitter_SliderAnchored
      nx_SetGadgetAttribute(id, #nxSplitter_SliderType, #nxSplitter_GripperWithNoDrag)

    Case #nxSplitter_AnchorReleased
      nx_SetGadgetAttribute(id, #nxSplitter_SliderType, #nxSplitter_GripperWithDrag)

    ;Uncomment the following to prevent the anchored gadget being alternated.
    ;Instead we ensure that only the first gadget is collapsed and anchored etc.

;    Case #nxSplitter_GripperClicked
;      result = #nxSplitter_AnchorFirstGadget  

  EndSelect
  ProcedureReturn result
EndProcedure


If OpenWindow(0, 100, 100, 600, 600, "©nxSoftware - nxSplitter example 2", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)

  ComboBoxGadget(1, 0,0,0,0)
  ButtonGadget(2, 0,0,0,0, "CLICK 2")
  EditorGadget(3,0,0,0,0)
  ;Create the two nxSplitters.
    nxSplitter_Create(4, 0,0, 0, 0, 1, 2, 3, #nxSplitter_Vertical|#nxSplitter_GripperWithDrag, @SplitterCallback())
    nxSplitter_Create(5, 40,40, WindowWidth(0)-80, WindowHeight(0)-80, 3, 4, 3, #nxSplitter_GripperWithDrag, @SplitterCallback())
  ;Set the color of the 'anchored sliders'.
    nx_SetGadgetColor(4, #nxSplitter_AnchoredSliderColor, #Black)
    nx_SetGadgetColor(5, #nxSplitter_AnchoredSliderColor, #Black)

  Repeat
    Event = WaitWindowEvent()
    Select Event
      Case #WM_SIZE
        ResizeGadget(5, #PB_Ignore, #PB_Ignore, WindowWidth(0)-120, WindowHeight(0)-80)
      Case #PB_Event_Gadget
        Select EventGadget()
        EndSelect
    EndSelect
  Until Event = #PB_Event_CloseWindow
EndIf
End
;///////////////////////////////////////////////////////////////////////////////////////////
The normal splitter resizes ok (the combobox should be full splitter height).

EDIT:

If you change the

Code: Select all

MoveWindow_(GadgetID(*nx\gad...
back to

Code: Select all

ResizeGadget(*nx\gad...
in 'nxSplitter_PositionGadgets' it works correctly.

Posted: Tue Dec 16, 2008 11:33 am
by srod
It doesn't work here with or without ResizeGadget() and it doesn't work with PB's regular splitter gadget either in that I can get that to misbehave as well. The thing with nxSplitter is that it assumes both child gadgets completely fill the client area of the splitter and thus doesn't bother erasing any unused space - because there will not be any. PB's splitter does not make this assumption and thus it is a little harder to get it to misbehave with a combo.

The problem seems to be that there is a height limit for the selection field of a combo-box gadget. I'll have to take a look on MSDN about this.

**EDIT : yes there is a max limit to the height you can set for a combo's selection field which is at the heart of the problem here. As I say PB's splitter gadget is not immune to this although it does handle things better in this respect. I guess the message is; do not use a combo in an nxSplitter gadget. :) The best I can do is probably have nxSplitter act more gracefully in these situations; effectively mimicking PB's splitter's behaviour here.

Posted: Tue Dec 16, 2008 12:37 pm
by srod
@Anthony, could you please test the latest version (PB 4.3 only).

Following a resize, the nxSplitter lib now examines each child gadget in turn to see if the child completely fills it's allotted space; if not some custom erasing ensues. This seems to be similar to what PB's splitter does and certainly removes the problems that I could see on my machine (Vista + XP).

As far as combo's are concerned; keeping the MoveWindow_() (which is my preferred option because there is far less flicker) means that the drop down list is resized. If you wish to switch to ResizeGadget() then the selection field will be resized up to the maximum etc. It's a matter of personal preference, but bear in mind that some other gadgets will flicker a lot more by using ResizeGadget().

Posted: Tue Dec 16, 2008 1:01 pm
by DoubleDutch
How about checking the gadget type - if combo use resize, else use move?

Will check the new code soon - just trying to fix the car! :(

Posted: Tue Dec 16, 2008 1:06 pm
by srod
DoubleDutch wrote:How about checking the gadget type - if combo use resize, else use move?

Will check the new code soon - just trying to fix the car! :(
I actually like the combo the way it is with MoveWindow_(), so I won't be making use of ResizeGadget() in this case. Feel free to add that yourself though (but of course any such alterations will not be added to the official download etc.)

Fix the car... ah give it a kick; that's what I do! Who needs to service a car when a good kicking usually works just as well! :)

Posted: Tue Dec 16, 2008 1:57 pm
by DoubleDutch
The new routine works (the corruption is gone), but here is the (slightly) modded routine for anyone who wants the special case ComboBox mod.

Code: Select all

;The following procedure positions and resizes the child gadgets following a resize etc.
Procedure nxSplitter_PositionGadgets(*nx._nxsplitter)
  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 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 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 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 GadgetType(*nx\gad1)=#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
This way the combobox will take on the new 4.30 'look'.

The car needs a new ignition barrel - too worn.

Posted: Wed Dec 17, 2008 12:08 pm
by srod
A new version of Nexus for PB 4.3 final will be released later as the current version of Nexus will not run. Only minor fixes required. DONE.

Posted: Fri Dec 19, 2008 12:07 pm
by srod
nxExplorerBar controls. (19th December 2008)

Updated the version of this control in the Purebasic 4.3 version (the version of Nexus for PB 4.2 is no longer supported).

You can now hide an entire group by simply setting the header item to have a height of zero (of course this only works if the group has a header item!) You can set this height at any time through the nx_SetGadgetItemAttribute() function.

Also fixed some bugs with this control.

:)

Posted: Thu Jan 29, 2009 10:59 am
by zikitrake
Donation done! :D
.
.
.
and... a request :lol: (for nxExplorerBar)

- Customize Icons Size for panels Header (currently fixed to 48x48), so it affect too to:

Code: Select all

;//line 608 of nxEplorerBar.pbi (PB4.30)
If *nxItem\hIcon
    rcTemp\left = #_nxexplorerbar_margin+45
    rcTemp\right = rcTemp\left + width-35
...
Thank you Srod for your useful codes

Posted: Thu Jan 29, 2009 12:00 pm
by srod
First you can use icons of any size as nxExplorerBar resizes as appropriate etc.

Altering the displayed icon size will require alterations to the positioning etc. Still easy enough to alter if you wish to. I will not alter my version however because previous tests simply didn't look good with icons of different sizes.

**EDIT : thanks for the donation; much appreciated. :)

Posted: Thu Jan 29, 2009 12:48 pm
by zikitrake
:D Thank you for fast reply.

I already have a modified version for 24x24 icons and fixed margin:

Image Image

But I'll need to re-modify NxExplorerBar.ini with each update.

Don't worry, it isen't a hard job.

:D for 5 € it's the best purchase. Bye!!

--- more help required ---
How can I change a MenuItemDescription ForeColor?

Code: Select all

#MENU_LATERAL = 1
Global TextoEstado.L

nxExplorerBar_Create(#MENU_LATERAL, 0, TBheight(#TB_Principal),MenuLateralAncho, Galtura, @ExplorerBarCallback())

Global nxEBItem.nxExplorerBar_NewItem

nxEBItem\type = #nxExplorerBar_Description
nxEBItem\font = FontID(LoadFont(#PB_Any, "Arial",10,#PB_Font_Bold))

TextoEstado = nx_AddGadgetItem(1, -1, "DESACTIVADO!", 0, nxEBItem)
...
;MAIN 
nxExplorerBar_SetGadgetItemAttribute(#MENU_LATERAL, TextoEstado, #nxExplorerBar_DescriptionForeColor, #Red)

Posted: Thu Jan 29, 2009 1:55 pm
by zikitrake
Well, about previous reply and to resume:

have you a code sample for?:

Code: Select all

nxExplorerBar_SetGadgetItemAttribute(menuid, itemid, #nxExplorerBar_DescriptionForeColor, MyColor)
Thank you and sorry for my short mind :?

Posted: Thu Jan 29, 2009 2:01 pm
by srod
No, you need to look in the "nxGadgets_Residents.pbi" file for a list of constants you can use with nx_SetGadgetItemAttribute() and #nxExplorerBar_DescriptionForeColor is NOT one of them! :wink:

To change the menu description fore colors you need to use nx_SetGadgetColor() and this will change the fore color of ALL menu descriptors. You cannot alter the color of individual descriptor items.

Use something like :

Code: Select all

nx_SetGadgetColor(1, #nxExplorerBar_DescriptionForeColor, #Red)
**EDIT : actually I cannot remember why I didn't allow for coloring indvidual descriptor items? It would be easy to add. Oh well, maybe later...

Posted: Thu Jan 29, 2009 2:09 pm
by zikitrake
:D Thank you!!!

Oh!, don't worry for this, I always can put a #nxExplorerBar_Container with standar PB TextGadgets.

Really grateful!