nsDialogs suggestion
I wanted to use a variation of an EDIT box, that limits input to numbers only. There is a style bit (ES_NUMBER) to do that, but no macros have been provided to allow adding styles to existing controls. So I modified nsDialogs.nsh (around line 248) from this:
!macro __NSD_DefineControl NAME
!define NSD_Create${NAME} "nsDialogs::CreateControl /NOUNLOAD ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}"
!macroend
to this:
!macro __NSD_CreateControl Name X Y H W TXT
!ifndef NSD_ADD_STYLE
!define NSD_ADD_STYLE 0
!endif
!ifndef NSD_ADD_EXSTYLE
!define NSD_ADD_EXSTYLE 0
!endif
nsDialogs::CreateControl /NOUNLOAD ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE}|${NSD_ADD_STYLE} ${__NSD_${Name}_EXSTYLE}|${NSD_ADD_EXSTYLE} ${X} ${Y} ${H} ${W} "${TXT}"
!undef NSD_ADD_STYLE
!undef NSD_ADD_EXSTYLE
!macroend
!macro __NSD_DefineControl NAME
!define NSD_Create${NAME} "!insertmacro __NSD_CreateControl ${Name} "
!macroend
The programmer (me) needs to !define the style they want to add before each call to NSD_CreateText, like this
!define NSD_ADD_STYLE ${ES_NUMBER}
${NSD_CreateText} 110u 48u 30u 11u "1000"
You can also add EXSTYLE (!define NSD_ADD_EXSTYLE ... ), and buttons as well as text boxes are good candidates.@kichik, what do you think about including a similar change to the next version of nsDialogs.nsh?
Don