Archive: ${NSD_CreateNumber} with up/down arrows (aka "spin control") possible?


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


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.

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.

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?

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.

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.

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


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

I'll leave that as an exercise for the reader ;)
( and another thread )


silly wiki link goes to an edit page.. figures.

here's a regular link: http://nsis.sourceforge.net/mediawik...ol_interaction


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.