Archive: Negative UDM_SETRANGE when using ${NSD_CreateUpDown}?


[SOLVED] Negative UDM_SETRANGE when using ${NSD_CreateUpDown}?
  For some reason, I am unable to make the UpDown control (AKA Spin control) display negative numbers.

I am using

  SendMessage $hUpDownOne ${UDM_SETRANGE} -7 6 ; min max
SendMessage $hUpDownOne ${UDM_SETPOS32} -2 $varUpDownOne

The documentation for UDM_SETRANGE says it accepts a short (which is signed by definition).

Can an UpDown control spin to negative values?

If so, what am I missing?

wParam is not used, lParam contains both the min and max values packed with MAKELPARAM, IIRC if you !include "WinCore.nsh" you should get the nsis macro version of it


Anders thanks for the quick reply. I am afraid I don't understand what "WinCore.nsh" has to do with this. ${NSD_CreateUpDown} and UDM_SETRANGE are working perfectly for me with positive numbers. It's only the negative numbers that don't work. Why?


I just told you why, both min and max are packed into LPARAM and since max is in the LOWORD it works correctly without packing for positive numbers: MAKELPARAM(666,0) == 666


nsh 

>${MAKELPARAM} $0 $0 666 -2
MessageBox mb_ok$0
>
If you don't want to deal with the packing, use UDM_SETRANGE32

Originally posted by Anders
use UDM_SETRANGE32
That was exactly my problem. I was using UDM_SETRANGE with UDM_SETPOS32... This isn't my best day... But thanks to your help, it's working with negative numbers now.

Thanks again!