Added more NSD editbox macros
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6909 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
adb47b8a58
commit
0322da94b2
5 changed files with 68 additions and 13 deletions
|
@ -59,7 +59,10 @@ blockquote pre { background-color: #fcfcfc; font-family: monospace; }
|
|||
<li><a href="#mref-addstyle">NSD_AddStyle</a>, <a href="#mref-addexstyle">NSD_AddExStyle</a></li>
|
||||
<li><a href="#mref-gettext">NSD_GetText</a>, <a href="#mref-settext">NSD_SetText</a></li>
|
||||
<li>Text, Password & Number:
|
||||
<a href="#mref-settextlimit">NSD_SetTextLimit</a></li>
|
||||
<a href="#mref-settextlimit">NSD_Edit_SetTextLimit</a>,
|
||||
<a href="#mref-edsetro">NSD_Edit_SetReadOnly</a>,
|
||||
<a href="#mref-edsetcuebanner">NSD_Edit_SetCueBannerText</a>
|
||||
</li>
|
||||
<li>CheckBox & RadioButton:
|
||||
<a href="#mref-getstate">NSD_GetState</a>,
|
||||
<a href="#mref-setstate">NSD_SetState</a>,
|
||||
|
@ -68,13 +71,13 @@ blockquote pre { background-color: #fcfcfc; font-family: monospace; }
|
|||
</li>
|
||||
<li>ComboBox & DropList:
|
||||
<a href="#mref-cbaddstring">NSD_CB_AddString</a>,
|
||||
NSD_CB_PrependString, NSD_CB_AppendString, <a href="#mref-cbinsstring">NSD_CB_InsertString</a>,
|
||||
<a href="#mref-cbinsstring">NSD_CB_PrependString, NSD_CB_AppendString, NSD_CB_InsertString</a>,
|
||||
<a href="#mref-cbselectstring">NSD_CB_SelectString</a>,
|
||||
<a href="#mref-cbgetcount">NSD_CB_GetCount</a>
|
||||
</li>
|
||||
<li>ListBox:
|
||||
<a href="#mref-lbaddstring">NSD_LB_AddString</a>,
|
||||
NSD_LB_PrependString, NSD_LB_AppendString, <a href="#mref-lbinsstring">NSD_LB_InsertString</a>,
|
||||
<a href="#mref-lbinsstring">NSD_LB_PrependString, NSD_LB_AppendString, NSD_LB_InsertString</a>,
|
||||
<a href="#mref-lbdelstring">NSD_LB_DelString</a>,
|
||||
<a href="#mref-lbdelitem">NSD_LB_DelItem</a>,
|
||||
<a href="#mref-lbclear">NSD_LB_Clear</a>,
|
||||
|
@ -594,9 +597,17 @@ SectionEnd</pre></blockquote>
|
|||
<p><code>${NSD_SetText} <i>control_HWND</i> <i>text</i></code></p>
|
||||
<p>Sets the text of a control.</p>
|
||||
|
||||
<h3><a name="mref-settextlimit"></a>NSD_SetTextLimit</h3>
|
||||
<p><code>${NSD_SetTextLimit} <i>control_HWND</i> <i>limit</i></code></p>
|
||||
<p>Sets input size limit for a text control.</p>
|
||||
<h3><a name="mref-settextlimit"></a>NSD_Edit_SetTextLimit</h3>
|
||||
<p><code>${NSD_Edit_SetTextLimit} <i>control_HWND</i> <i>limit</i></code></p>
|
||||
<p>Sets the input length limit for a text control.</p>
|
||||
|
||||
<h3><a name="mref-edsetro"></a>NSD_Edit_SetReadOnly</h3>
|
||||
<p><code>${NSD_Edit_SetReadOnly} <i>control_HWND</i> <i>readonly</i></code></p>
|
||||
<p>1 to make the text control read-only or 0 to allow the user to input data.</p>
|
||||
|
||||
<h3><a name="mref-edsetcuebanner"></a>NSD_Edit_SetCueBannerText</h3>
|
||||
<p><code>${NSD_Edit_SetCueBannerText} <i>control_HWND</i> <i>displaywhenfocused</i> <i>text</i></code></p>
|
||||
<p>Set a text hint displayed when the control is empty. The text is only visible on WinXP and later. Requires <i>XPStyle on</i>.</p>
|
||||
|
||||
<h3><a name="mref-getstate"></a>NSD_GetState</h3>
|
||||
<p><code>${NSD_GetState} <i>control_HWND</i> <i>$output_variable</i></code></p>
|
||||
|
@ -623,6 +634,8 @@ SectionEnd</pre></blockquote>
|
|||
|
||||
<h3><a name="mref-cbinsstring"></a>NSD_CB_InsertString</h3>
|
||||
<p><code>${NSD_CB_InsertString} <i>combo_HWND</i> <i>index</i> <i>string</i></code></p>
|
||||
<p><code>${NSD_CB_PrependString} <i>combo_HWND</i> <i>string</i></code></p>
|
||||
<p><code>${NSD_CB_AppendString} <i>combo_HWND</i> <i>string</i></code></p>
|
||||
<p>Insert a string in a specified position in a combo box.</p>
|
||||
|
||||
<h3><a name="mref-cbselectstring"></a>NSD_CB_SelectString</h3>
|
||||
|
@ -638,6 +651,8 @@ SectionEnd</pre></blockquote>
|
|||
|
||||
<h3><a name="mref-lbinsstring"></a>NSD_LB_InsertString</h3>
|
||||
<p><code>${NSD_LB_InsertString} <i>listbox_HWND</i> <i>index</i> <i>string</i></code></p>
|
||||
<p><code>${NSD_LB_PrependString} <i>listbox_HWND</i> <i>string</i></code></p>
|
||||
<p><code>${NSD_LB_AppendString} <i>listbox_HWND</i> <i>string</i></code></p>
|
||||
<p>Insert a string in a specified position in a list box.</p>
|
||||
|
||||
<h3><a name="mref-lbdelstring"></a>NSD_LB_DelString</h3>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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})
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue