diff --git a/Contrib/nsDialogs/Readme.html b/Contrib/nsDialogs/Readme.html index 635f6b9f..3fa53f44 100644 --- a/Contrib/nsDialogs/Readme.html +++ b/Contrib/nsDialogs/Readme.html @@ -63,12 +63,19 @@ code
  • NSD_OnChange
  • NSD_OnClick
  • NSD_OnNotify
  • +
  • NSD_AddStyle
  • +
  • NSD_AddExStyle
  • NSD_GetText
  • NSD_SetText
  • +
  • NSD_SetTextLimit
  • NSD_GetState
  • NSD_SetState
  • NSD_Check
  • NSD_Uncheck
  • +
  • NSD_CB_AddString
  • +
  • NSD_CB_SelectString
  • +
  • NSD_LB_AddString
  • +
  • NSD_LB_SelectString
  • NSD_SetFocus
  • NSD_SetImage
  • NSD_SetStretchedImage
  • @@ -636,6 +643,22 @@ SectionEnd

    See OnNotify for more details.

    +

    NSD_AddStyle

    + +

    ${NSD_AddStyle} control_HWND style

    + +

    Adds one or more window style to a control. Multiple styles should be separated with pipes `|'.

    + +

    See MSDN for style description.

    + +

    NSD_AddExStyle

    + +

    ${NSD_AddExStyle} control_HWND style

    + +

    Adds one or more extended window style to a control. Multiple styles should be separated with pipes `|'.

    + +

    See MSDN for style description.

    +

    NSD_GetText

    ${NSD_GetText} control_HWND output_variable

    @@ -650,6 +673,12 @@ SectionEnd

    Sets the text of a control.

    +

    NSD_SetTextLimit

    + +

    ${NSD_SetTextLimit} control_HWND limit

    + +

    Sets input size limit for a text control.

    +

    NSD_GetState

    ${NSD_GetState} control_HWND output_variable

    @@ -680,6 +709,30 @@ SectionEnd

    See Memory for usage example.

    +

    NSD_CB_AddString

    + +

    ${NSD_CB_AddString} combo_HWND string

    + +

    Adds a string to a combo box.

    + +

    NSD_CB_SelectString

    + +

    ${NSD_CB_SelectString} combo_HWND string

    + +

    Selects a string in a combo box.

    + +

    NSD_LB_AddString

    + +

    ${NSD_LB_AddString} combo_HWND string

    + +

    Adds a string to a list box.

    + +

    NSD_LB_SelectString

    + +

    ${NSD_LB_SelectString} combo_HWND string

    + +

    Selects a string in a list box.

    +

    NSD_SetFocus

    ${NSD_SetFocus} control_HWND

    diff --git a/Contrib/nsDialogs/nsDialogs.nsh b/Contrib/nsDialogs/nsDialogs.nsh index ac4b35eb..1c93066c 100644 --- a/Contrib/nsDialogs/nsDialogs.nsh +++ b/Contrib/nsDialogs/nsDialogs.nsh @@ -171,6 +171,9 @@ Header file for creating custom installer pages with nsDialogs !define IMAGE_CURSOR 2 !define IMAGE_ENHMETAFILE 3 +!define GWL_STYLE -16 +!define GWL_EXSTYLE -20 + !define DEFAULT_STYLES ${WS_CHILD}|${WS_VISIBLE}|${WS_CLIPSIBLINGS} !define __NSD_HLine_CLASS STATIC @@ -301,6 +304,32 @@ Header file for creating custom installer pages with nsDialogs !insertmacro __NSD_DefineCallback Notify !insertmacro __NSD_DefineCallback Back +!macro _NSD_AddStyle CONTROL STYLE + + Push $0 + + System::Call "user32::GetWindowLong(i ${CONTROL}, i ${GWL_STYLE}) i .r0" + System::Call "user32::SetWindowLong(i ${CONTROL}, i ${GWL_STYLE}, i $0|${STYLE})" + + Pop $0 + +!macroend + +!define NSD_AddStyle "!insertmacro _NSD_AddStyle" + +!macro _NSD_AddExStyle CONTROL EXSTYLE + + Push $0 + + System::Call "user32::GetWindowLong(i ${CONTROL}, i ${GWL_EXSTYLE}) i .r0" + System::Call "user32::SetWindowLong(i ${CONTROL}, i ${GWL_EXSTYLE}, i $0|${EXSTYLE})" + + Pop $0 + +!macroend + +!define NSD_AddExStyle "!insertmacro _NSD_AddExStyle" + !macro __NSD_GetText CONTROL VAR System::Call user32::GetWindowText(i${CONTROL},t.s,i${NSIS_MAX_STRLEN}) @@ -318,6 +347,14 @@ Header file for creating custom installer pages with nsDialogs !define NSD_SetText `!insertmacro __NSD_SetText` +!macro _NSD_SetTextLimit CONTROL LIMIT + + SendMessage ${CONTROL} ${EM_SETLIMITTEXT} ${LIMIT} 0 + +!macroend + +!define NSD_SetTextLimit "!insertmacro _NSD_SetTextLimit" + !macro __NSD_GetState CONTROL VAR SendMessage ${CONTROL} ${BM_GETCHECK} 0 0 ${VAR} @@ -358,6 +395,38 @@ Header file for creating custom installer pages with nsDialogs !define NSD_SetFocus `!insertmacro __NSD_SetFocus` +!macro _NSD_CB_AddString CONTROL STRING + + SendMessage ${CONTROL} ${CB_ADDSTRING} 0 `STR:${STRING}` + +!macroend + +!define NSD_CB_AddString "!insertmacro _NSD_CB_AddString" + +!macro _NSD_CB_SelectString CONTROL STRING + + SendMessage ${CONTROL} ${CB_SELECTSTRING} -1 `STR:${STRING}` + +!macroend + +!define NSD_CB_SelectString "!insertmacro _NSD_CB_SelectString" + +!macro _NSD_LB_AddString CONTROL STRING + + SendMessage ${CONTROL} ${LB_ADDSTRING} 0 `STR:${STRING}` + +!macroend + +!define NSD_LB_AddString "!insertmacro _NSD_LB_AddString" + +!macro _NSD_LB_SelectString CONTROL STRING + + SendMessage ${CONTROL} ${LB_SELECTSTRING} -1 `STR:${STRING}` + +!macroend + +!define NSD_LB_SelectString "!insertmacro _NSD_LB_SelectString" + !macro __NSD_SetImage CONTROL IMAGE HANDLE Push $0