- NSIS Discussion
- ${NSD_CreateNumber} with up/down arrows (aka "spin control") possible?
Archive: ${NSD_CreateNumber} with up/down arrows (aka "spin control") possible?
nsnb
18th April 2010 17:12 UTC
${NSD_CreateNumber} with up/down arrows (aka "spin control") possible?
I have been trying to find some information on what's known in MFC as "spin control" but I couldn't find any.
Is there a different name for it, or this simply is not supported yet in nsDialogs?
Thanks.
Wizou
18th April 2010 17:28 UTC
Not yet supported.
Here is what I come up with to add support:
insertmacro __NSD_DefineControl UpDown
>
then try creating a UpDown control with nsDialogs just after your edit field
Note: I didn't test this.
Animaether
18th April 2010 19:01 UTC
Wizou's ${NSD_CreateUpDown} code works fine. Just keep in mind that NSD_OnClick and _OnChange will do nothing for the UpDown control, so set _OnChange up on its buddy control (typically a ${NSD_CreateText}) instead.
You may also want to set up some sane range (the default is inverted, for one) and a default value:
onchange
>
If you do use a Buddy control, you might also have to do some sanity checking yourself. E.g. you can enter a value in the Text control that is outside of the UpDown control's range.
nsnb
26th September 2010 14:14 UTC
Wizou and Animaether, thanks for your replies. I tried implementing your code. It displays very well, but when I click the up/down arrows, nothing changes in the buddy. Any idea what could be missing?
Here is my code:
FunctionEnd
>
Isn't the associated buddy supposed to change automatically upon clicking an up/down arrow? (otherwise it wouldn't have been called a buddy, right?)
There is something I am missing here but I don't know what it is. Any idea?
Animaether
26th September 2010 14:39 UTC
You have forgotten to include ${UDS_SETBUDDYINT} in your updown control's style.
UDS_SETBUDDYINT
Causes the up-down control to set the text of the buddy window (using the WM_SETTEXT message) when the position changes. The text consists of the position formatted as a decimal or hexadecimal string.
nsnb
26th September 2010 15:42 UTC
Originally posted by Animaether
You have forgotten to include ${UDS_SETBUDDYINT} in your updown control's style.
You were right on the money. Thank you Animaether.
Animaether
27th September 2010 19:09 UTC
I have added a section to the nsDialogs FAQ, where you can also grab the correct method of handling UpDown control interaction:
http://nsis.sourceforge.net/mediawik...ol_interaction
nsnb
27th September 2010 19:43 UTC
Originally posted by Animaether
I have added a section to the nsDialogs FAQ, where you can also grab the correct method of handling UpDown control interaction:
http://nsis.sourceforge.net/mediawik...ol_interaction
Animaether, you rock! Thank you very much.
Now, it would be nice to have the same for the Date and Time Picker :)
http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx
Animaether
27th September 2010 20:40 UTC
I'll leave that as an exercise for the reader ;)
( and another thread )
Animaether
27th September 2010 22:51 UTC
silly wiki link goes to an edit page.. figures.
here's a regular link: http://nsis.sourceforge.net/mediawik...ol_interaction
Animaether
1st October 2010 19:36 UTC
nsnb - what did you need that DateTime control for?
I'm miraculously finding myself with a project where I might end up using it ( you must have jynxed me ;) ).. so I've got all of the important bits going.. but plan on finishing it up into a user-friendly and global variables-eating header file as the bugger is fairly extensive in messages/notifications bits.