Nexus -library of custom gadgets (32-bit / 64-bit)

Developed or developing a new product in PureBasic? Tell the world about it.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

nxPropertyBox and nxSplitter controls.
These controls have both undergone a quite major update (Purebasic 4.3 version). In the case of the nxPropertyBox control, the alterations will break all existing code (my apologies), though any modifications required by applications will be very straight forward.

nxPropertyBox.
It is now possible to add items which do not belong to any 'group'. To do this the nx_AddGadgetItem() function has been changed for this control.

The 'imageID' parameter now points to the new item's nxPropertyBox_Item structure (not the 'flags' parameter) whilst the 'flags' parameter is to hold a non-zero value if the new item is to belong to the 'current' group (if there is one). See the demo programs for examples of how to employ these alterations.

Note that I have not automatically indented 'child' items for various reasons; not the least of which is the fact that some property boxes might allow the labels to be edited etc. and this would then require a quite major update to EsGRID which I do not have time for right now. Instead, you can simply pad child items label text with spaces if appropriate.


nxSplitter.
Have made alterations to extend the functionality of this control. You can now take steps to embed multiple controls directly within a nxSplitter without having to embed them first within a container gadget etc. This is because the control no longer complains if one of the two 'split' controls is omitted and also due to the fact that the #nxSplitter_GadgetsResized callback message is far more 'refined'. (See the nxGadgets_Residents.pbi source file for details).
There is also a new callback message : #nxSplitter_CustomPaint for those applications wishing to paint directly to the splitter control etc. (advanced users only).

Regards.
I may look like a mule, but I'm not a complete ass.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

I've just downloaded the ProGUI lib and there is a slight different in his residents to yours...

#I_IMAGENONE = $FFFFFFFFFFFFFFFE

vs.

#I_IMAGENONE = $FFFFFFFE

I know you both mean -2, but which one should win?
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

Uhm, in which Nexus source file is this constant - I cannot find it!
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

This constant does not appear in the Nexus source at all. It does appear, however, in the nxToolbar source!

Just change the constant to -2 and you'll have no problem.
I may look like a mule, but I'm not a complete ass.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Oops! sorry your right - it was the toolbar. Thanks for confirming -2 is ok.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Post by srod »

28th July 2009 - nxPropertyBox controls.

This update fixes quite a number of bugs with the nxPropertyBox control following my work upon the Pyrex report designer. I can finally say that the damn thing is now working like a property box control should! :wink:

The main problems were related to the notifications sent by the control to the developer's callback as the user altered properties etc.

Regards.
I may look like a mule, but I'm not a complete ass.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Thanks for the update. :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
Digital Wargames
Enthusiast
Enthusiast
Posts: 203
Joined: Sat May 23, 2009 4:39 am

Post by Digital Wargames »

Thank you, bossman
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: Nexus -library of custom gadgets (updated : 28/7/09)

Post by DoubleDutch »

Just doing some major updates to ElementaryReports, so I thought I'd share some routines I use to manipulate various splitters for alternative views and to reduce 'initial' flicker caused by setting control positions...

Code: Select all

;The following swaps the specified splitter
Procedure nxSplitter_Swap(id,refresh=#True)
  Protected hWnd, *nx._nxsplitter
  ;Check we have a valid splitter control, signified by the presence of the window property.
    If IsGadget(id)
      hWnd = GadgetID(id)
      *nx = GetProp_(hWnd, @"nxSPLITTER_PROP")
      If *nx ;A valid splitter control.
				temp=*nx\gad1
				*nx\gad1=*nx\gad2
				*nx\gad2=temp
				If refresh
	        nxSplitter_PositionGadgets(*nx)
	      EndIf
      EndIf
    EndIf
EndProcedure

;The following exchanges the specified splitter gadget's first split
Procedure nxSplitter_Exchange(id,id2,refresh=#True)
  Protected hWnd, *nx._nxsplitter, hWnd2, *nx2._nxsplitter
  ;Check we have a valid splitter control, signified by the presence of the window property.
    If IsGadget(id) And IsGadget(id2)
      hWnd = GadgetID(id)
      hWnd2 = GadgetID(id2)
      *nx = GetProp_(hWnd, @"nxSPLITTER_PROP")
      *nx2 = GetProp_(hWnd2, @"nxSPLITTER_PROP")
      If *nx And *nx2 ; both valid splitter control.
      	SetParent_(GadgetID(*nx\gad1),hWnd2)
      	SetParent_(GadgetID(*nx2\gad1),hWnd)
				temp=*nx\gad1
				*nx\gad1=*nx2\gad1
				*nx2\gad1=temp
				If refresh
	        nxSplitter_PositionGadgets(*nx)
  	      nxSplitter_PositionGadgets(*nx2)
 				EndIf
      EndIf
    EndIf
EndProcedure

;The following directly sets the splitter state
Procedure nxSplitter_SetPos(id,state,refresh=#True)
  Protected hWnd, *nx._nxsplitter
  ;Check we have a valid splitter control, signified by the presence of the window property.
    If IsGadget(id)
      hWnd = GadgetID(id)
      *nx = GetProp_(hWnd, @"nxSPLITTER_PROP")
      If *nx ;A valid splitter control.
				*nx\splitterPos = state
				If refresh
	        nxSplitter_PositionGadgets(*nx)
	      EndIf
      EndIf
    EndIf
EndProcedure	
	      
Procedure RefreshView(mode)

	Select mode
		Case	0	; Split
		
			If nx_GetGadgetAttribute(#MiddleSplitter,#nxSplitter_FirstGadget)<>#TopSplitter
				nxSplitter_Swap(#MiddleSplitter,#False)
			EndIf
			If nx_GetGadgetAttribute(#TopSplitter,#nxSplitter_FirstGadget)=#StudentContainer
				nxSplitter_Exchange(#TopSplitter,#BottomSplitter,#False)
				nxSplitter_Swap(#TopSplitter,#False)
			EndIf
					
			nxSplitter_SetPos(#MiddleSplitter,MiddleBorderPosition,#False)
			nx_SetGadgetState(#MiddleSplitter,#nxSplitter_AnchorSecondGadget)
			nx_SetGadgetState(#BottomSplitter,StudentListWidth)
			nx_SetGadgetState(#TopSplitter,MiddleHorizontalPosition)
			
		Case	1	; Multi
			If nx_GetGadgetAttribute(#MiddleSplitter,#nxSplitter_FirstGadget)<>#BottomSplitter
				nxSplitter_Swap(#MiddleSplitter,#False)
			EndIf
			If nx_GetGadgetAttribute(#TopSplitter,#nxSplitter_FirstGadget)<>#StudentContainer
				nxSplitter_Swap(#TopSplitter,#False)
				nxSplitter_Exchange(#TopSplitter,#BottomSplitter,#False)
			EndIf
					
			nx_SetGadgetState(#MiddleSplitter,MiddleBorderPosition)
			nxSplitter_SetPos(#TopSplitter,StudentListWidth,#False)
			nx_SetGadgetState(#TopSplitter,#nxSplitter_AnchorFirstGadget)
			nx_SetGadgetState(#BottomSplitter,MiddleHorizontalPosition)
			
		Case	2	; Full
			If nx_GetGadgetAttribute(#MiddleSplitter,#nxSplitter_FirstGadget)<>#TopSplitter
				nxSplitter_Swap(#MiddleSplitter,#False)
			EndIf
			If nx_GetGadgetAttribute(#TopSplitter,#nxSplitter_FirstGadget)<>#StudentContainer
				nxSplitter_Swap(#TopSplitter,#False)
				nxSplitter_Exchange(#TopSplitter,#BottomSplitter,#False)
			EndIf
				
			nxSplitter_SetPos(#MiddleSplitter,MiddleBorderPosition,#False)
			nx_SetGadgetState(#MiddleSplitter,#nxSplitter_AnchorSecondGadget)
			nxSplitter_SetPos(#TopSplitter,StudentListWidth,#False)
			nx_SetGadgetState(#TopSplitter,#nxSplitter_AnchorFirstGadget)
			nx_SetGadgetState(#BottomSplitter,MiddleHorizontalPosition)
			
		Case	3	; Elementary
			If nx_GetGadgetAttribute(#MiddleSplitter,#nxSplitter_FirstGadget)<>#TopSplitter
				nxSplitter_Swap(#MiddleSplitter,#False)
			EndIf
			If nx_GetGadgetAttribute(#TopSplitter,#nxSplitter_FirstGadget)<>#StudentContainer
				nxSplitter_Swap(#TopSplitter,#False)
				nxSplitter_Exchange(#TopSplitter,#BottomSplitter,#False)
			EndIf
					
			nx_SetGadgetState(#MiddleSplitter,MiddleBorderPosition)
			nx_SetGadgetState(#TopSplitter,StudentListWidth)
			nx_SetGadgetState(#BottomSplitter,FavouritesTreeWidth)
			
	EndSelect
EndProcedure
The last example shows usage. Hope you find them useful. :)
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Re: Nexus -library of custom gadgets (updated : 28/7/09)

Post by Arctic Fox »

Regarding the nxExplorerBar:
Am I breaking something if I turn off the timer (MouseTimer) and instead call that procedure in nxExplorerBar_panelCallback() at a #WM_MOUSEMOVE event (to get rid of the #WM_TIMER event)?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Nexus -library of custom gadgets (updated : 28/7/09)

Post by srod »

Conceivably you will indeed be breaking something yes. #WM_MOUSEMOVE events will only be received when the mouse moves across whatever window you have subclassed to receive this message. This is fine except that nxExplorerBar sometimes needs to receive notifications beyond this - e.g. it needs to know when the mouse is not over the control etc. Relying upon #WM_MOUSEMOVE is not reliable in such situations. You would need to use something like the TrackMouseEvent() api instead.

Can I ask why you wish to remove the timer? It shouldn't clash with PB's new timer commands and events except that it has an eventID of 0. You might change this to something like 1000 to avoid clashes etc.
I may look like a mule, but I'm not a complete ass.
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Re: Nexus -library of custom gadgets (updated : 28/7/09)

Post by Arctic Fox »

Oh, I see :(
The #WM_TIMER event just seems to 'spoil' the meaning of WaitWindowEvent() as there is always an event occuring.

Is it then possible to call the procedure manually in the event loop as a response to #WM_MOUSEMOVE and #WM_MOUSELEAVE using TrackMouseEvent() as you suggest?
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Nexus -library of custom gadgets (updated : 28/7/09)

Post by srod »

You will find (under Vista at least) that certain common controls use their own timers as well and so, well, is there any point trying to remove the nxExplorer timer just to satisfy WaitWindowEvent() as you'll only get caught by the other timers anyhow?

If you wish to use TrackMouseEvent() instead then, well, you'll need to be careful.
Last edited by srod on Sun Oct 04, 2009 2:26 pm, edited 1 time in total.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: Nexus -library of custom gadgets (updated : 28/7/09)

Post by srod »

Okay Arctic, here is a test version of the nxExplorer which does not use a timer and instead uses the TrackMouseEvent() api.

http://www.purecoder.net/nxExplorerBar.pbi

Please let me know if it works okay because I haven't done much testing. If it passes the Artic test then I shall consider making this the official version. :wink:
I may look like a mule, but I'm not a complete ass.
User avatar
Arctic Fox
Enthusiast
Enthusiast
Posts: 609
Joined: Sun Dec 21, 2008 5:02 pm
Location: Aarhus, Denmark

Re: Nexus -library of custom gadgets (updated : 28/7/09)

Post by Arctic Fox »

I have not run into these controls... yet :wink: (except the highlight animation for ButtonGadgets and StringGadgets)

Your new test version of the nxExplorerBar works perfectly here - it even works with the Windows Vista Flip 3D (updates the window) :D
Tried with window sizing, minimizing, maximizing and 'cursor-out-of-window' - no problems :o

Thanks a bunch, srod, your help is very appreciated :!:
Post Reply