diff --git a/Contrib/nsDialogs/Readme.html b/Contrib/nsDialogs/Readme.html index e1b49946..2c7ba8ec 100644 --- a/Contrib/nsDialogs/Readme.html +++ b/Contrib/nsDialogs/Readme.html @@ -59,7 +59,10 @@ blockquote pre { background-color: #fcfcfc; font-family: monospace; }
  • NSD_AddStyle, NSD_AddExStyle
  • NSD_GetText, NSD_SetText
  • Text, Password & Number: -NSD_SetTextLimit
  • +NSD_Edit_SetTextLimit, +NSD_Edit_SetReadOnly, +NSD_Edit_SetCueBannerText +
  • CheckBox & RadioButton: NSD_GetState, NSD_SetState, @@ -68,13 +71,13 @@ blockquote pre { background-color: #fcfcfc; font-family: monospace; }
  • ComboBox & DropList: NSD_CB_AddString, -NSD_CB_PrependString, NSD_CB_AppendString, NSD_CB_InsertString, +NSD_CB_PrependString, NSD_CB_AppendString, NSD_CB_InsertString, NSD_CB_SelectString, NSD_CB_GetCount
  • ListBox: NSD_LB_AddString, -NSD_LB_PrependString, NSD_LB_AppendString, NSD_LB_InsertString, +NSD_LB_PrependString, NSD_LB_AppendString, NSD_LB_InsertString, NSD_LB_DelString, NSD_LB_DelItem, NSD_LB_Clear, @@ -594,9 +597,17 @@ SectionEnd

    ${NSD_SetText} control_HWND text

    Sets the text of a control.

    -

    NSD_SetTextLimit

    -

    ${NSD_SetTextLimit} control_HWND limit

    -

    Sets input size limit for a text control.

    +

    NSD_Edit_SetTextLimit

    +

    ${NSD_Edit_SetTextLimit} control_HWND limit

    +

    Sets the input length limit for a text control.

    + +

    NSD_Edit_SetReadOnly

    +

    ${NSD_Edit_SetReadOnly} control_HWND readonly

    +

    1 to make the text control read-only or 0 to allow the user to input data.

    + +

    NSD_Edit_SetCueBannerText

    +

    ${NSD_Edit_SetCueBannerText} control_HWND displaywhenfocused text

    +

    Set a text hint displayed when the control is empty. The text is only visible on WinXP and later. Requires XPStyle on.

    NSD_GetState

    ${NSD_GetState} control_HWND $output_variable

    @@ -623,6 +634,8 @@ SectionEnd

    NSD_CB_InsertString

    ${NSD_CB_InsertString} combo_HWND index string

    +

    ${NSD_CB_PrependString} combo_HWND string

    +

    ${NSD_CB_AppendString} combo_HWND string

    Insert a string in a specified position in a combo box.

    NSD_CB_SelectString

    @@ -638,6 +651,8 @@ SectionEnd

    NSD_LB_InsertString

    ${NSD_LB_InsertString} listbox_HWND index string

    +

    ${NSD_LB_PrependString} listbox_HWND string

    +

    ${NSD_LB_AppendString} listbox_HWND string

    Insert a string in a specified position in a list box.

    NSD_LB_DelString

    diff --git a/Contrib/nsDialogs/example.nsi b/Contrib/nsDialogs/example.nsi index 715500ec..8d398e17 100644 --- a/Contrib/nsDialogs/example.nsi +++ b/Contrib/nsDialogs/example.nsi @@ -38,6 +38,7 @@ Function nsDialogsPage Pop $EDIT GetFunctionAddress $0 OnChange nsDialogs::OnChange $EDIT $0 + ${NSD_Edit_SetCueBannerText} $EDIT 0 "Type 'hello there' and get a free surprise" ${NSD_CreateCheckbox} 0 -50 100% 8u Test Pop $CHECKBOX diff --git a/Contrib/nsDialogs/nsDialogs.nsh b/Contrib/nsDialogs/nsDialogs.nsh index f1d0a259..e03dd05d 100644 --- a/Contrib/nsDialogs/nsDialogs.nsh +++ b/Contrib/nsDialogs/nsDialogs.nsh @@ -421,6 +421,7 @@ SendMessage ${hCtl} ${${msg}} ${wp} ${lp} SendMessage ${hCtl} ${${msg}} ${wp} ${lp} ${VAR} !macroend + !define NSD_InitCommonControlsEx "!insertmacro __NSD_InitCommonControlsEx " !macro __NSD_InitCommonControlsEx ICC System::Int64Op ${ICC} << 32 @@ -459,6 +460,18 @@ System::Call 'COMCTL32::InitCommonControlsEx(*ls)' ; INITCOMMONCONTROLSEX as UIN System::Call "user32::SetWindowLong(p${HWND},p${GWL},ps)" !macroend +!define NSD_GetStyle "!insertmacro _NSD_GWLGetFlags ${GWL_STYLE} " +!define NSD_GetExStyle "!insertmacro _NSD_GWLGetFlags ${GWL_EXSTYLE} " +!macro _NSD_GWLGetFlags GWL HWND RET +System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s" +Pop ${RET} +!macroend + +!macro __NSD_GetStyleBit GWL BIT HWND RET +!insertmacro _NSD_GWLGetFlags ${GWL} ${HWND} ${RET} +IntOp ${RET} ${RET} & ${BIT} +!macroend + !define NSD_SetFocus `!insertmacro __NSD_SetFocus ` !macro __NSD_SetFocus HWND @@ -479,11 +492,33 @@ System::Call 'COMCTL32::InitCommonControlsEx(*ls)' ; INITCOMMONCONTROLSEX as UIN !macroend -!define NSD_SetTextLimit "!insertmacro _NSD_SetTextLimit " -!macro _NSD_SetTextLimit CONTROL LIMIT - SendMessage ${CONTROL} ${EM_SETLIMITTEXT} ${LIMIT} 0 +### Edit ### + +!define NSD_Edit_GetTextLimit `${__NSD_MkCtlCmd_RV} EM_GETLIMITTEXT 0 0 ` +!define NSD_Edit_SetTextLimit `${__NSD_MkCtlCmd_WP} EM_SETLIMITTEXT 0 ` +!define NSD_Edit_SetPasswordChar `${__NSD_MkCtlCmd_WP} EM_SETPASSWORDCHAR 0 ` +!define NSD_Edit_GetReadOnly `!insertmacro __NSD_GetStyleBit ${GWL_STYLE} ${ES_READONLY} ` ; Non-zero if read-only +!define NSD_Edit_SetReadOnly `${__NSD_MkCtlCmd_WP} EM_SETREADONLY 0 ` ; Toggles the ES_READONLY style +!define NSD_Edit_GetModify `${__NSD_MkCtlCmd_RV} EM_GETMODIFY 0 0 ` +!define NSD_Edit_SetModify `${__NSD_MkCtlCmd_WP} EM_SETMODIFY 0 ` +!define NSD_Edit_EmptyUndoBuffer `${__NSD_MkCtlCmd} EM_EMPTYUNDOBUFFER 0 0 ` +!define NSD_Edit_CanUndo `${__NSD_MkCtlCmd_RV} EM_CANUNDO 0 0 ` +!define NSD_Edit_ScrollCaret `${__NSD_MkCtlCmd} EM_SCROLLCARET 0 0 ` +!define NSD_Edit_SetSel `${__NSD_MkCtlCmd_WPLP} EM_SETSEL ` ; WP:Start LP:End + +!define NSD_Edit_SetCueBannerText "!insertmacro __NSD_Edit_SetCueBannerText " ; CC6+ +!macro __NSD_Edit_SetCueBannerText CONTROL SHOWWHENFOCUSED TEXT +!if ${NSIS_CHAR_SIZE} > 1 + SendMessage ${CONTROL} ${EM_SETCUEBANNER} ${SHOWWHENFOCUSED} `STR:${TEXT}` +!else + System::Call 'USER32::SendMessage(p${CONTROL},i${EM_SETCUEBANNER},p${SHOWWHENFOCUSED},ws)' `${TEXT}` ; Must be PWSTR +!endif !macroend +!define NSD_SetTextLimit `${NSD_Edit_SetTextLimit} ` ; Legacy alias + + +### CheckBox ### !define NSD_GetState `!insertmacro __NSD_GetState ` !macro __NSD_GetState CONTROL VAR @@ -496,9 +531,6 @@ System::Call 'COMCTL32::InitCommonControlsEx(*ls)' ; INITCOMMONCONTROLSEX as UIN SendMessage ${CONTROL} ${BM_SETCHECK} ${STATE} 0 !macroend - -### CheckBox ### - !define NSD_Check `!insertmacro __NSD_Check ` !macro __NSD_Check CONTROL ${NSD_SetState} ${CONTROL} ${BST_CHECKED} diff --git a/Docs/src/history.but b/Docs/src/history.but index 161bb0dd..ec178702 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -6,7 +6,7 @@ Released on ??? ??rd, 20?? \S1{v3.03-cl} Changelog -\S2{} Minor Changes +\S2{} Major Changes \b Added more NSD controls and macros (\W{http://sf.net/p/nsis/feature-requests/543}{RFE #543}) diff --git a/Include/WinMessages.nsh b/Include/WinMessages.nsh index ee9e79b7..eee63320 100644 --- a/Include/WinMessages.nsh +++ b/Include/WinMessages.nsh @@ -170,6 +170,11 @@ TVM Tree-view control !define CB_SETLOCALE 0x0159 !define CB_SETTOPINDEX 0x015c !define CB_SHOWDROPDOWN 0x014F +!define CBM_FIRST 0x1700 ; Vista+ +!define /math CB_SETMINVISIBLE ${CBM_FIRST} + 1 +!define /math CB_GETMINVISIBLE ${CBM_FIRST} + 2 +!define /math CB_SETCUEBANNER ${CBM_FIRST} + 3 +!define /math CB_GETCUEBANNER ${CBM_FIRST} + 4 !define CB_ERR -1 @@ -214,6 +219,8 @@ TVM Tree-view control !define EM_SETTABSTOPS 0x00CB !define EM_SETWORDBREAKPROC 0x00D0 !define EM_UNDO 0x00C7 +!define ECM_FIRST 0x1500 ; CC6+ +!define /math EM_SETCUEBANNER ${ECM_FIRST} + 1 #Listbox Messages# !define LB_ADDFILE 0x0196