applied patch #1848940 - nsDialogs - Additions
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5396 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
916d3ea3a2
commit
87b50cca3f
2 changed files with 540 additions and 497 deletions
|
@ -35,6 +35,7 @@ code
|
|||
<li><a href="#step-add">Adding Controls</a></li>
|
||||
<li><a href="#step-state">Control State</a></li>
|
||||
<li><a href="#step-notify">Real-time Notification</a></li>
|
||||
<li><a href="#helpful-macros">Helpful macros</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -241,6 +242,7 @@ SectionEnd</pre></blockquote>
|
|||
<li>CheckBox</li>
|
||||
<li>RadioButton</li>
|
||||
<li>Text</li>
|
||||
<li>Password</li>
|
||||
<li>FileRequest</li>
|
||||
<li>DirRequest</li>
|
||||
<li>ComboBox</li>
|
||||
|
@ -249,7 +251,7 @@ SectionEnd</pre></blockquote>
|
|||
|
||||
<h3><a name="step-state"></a>Control State</h3>
|
||||
|
||||
<p>Now that we have some controls that the user can interact with, it's time to see what the user actually does with them. For that, we'll first add a <i>leave callback</i> function to our page. In that function, we'll query the state of the text control we've created and display it to the user. To do so, we'll use the ${NSD_GetText} macro.</p>
|
||||
<p>Now that we have some controls that the user can interact with, it's time to see what the user actually does with them. For that, we'll first add a <i>leave callback</i> function to our page. In that function, we'll query the state of the text control we've created and display it to the user. To do so, we'll use the ${NSD_GetText} macro. Use the ${NSD_GetState} macro for RadioButton and CheckBox controls.</p>
|
||||
|
||||
<p>Note that not all controls support ${NSD_GetText} and some require special handling with specific messages defined in WinMessages.nsh. For example, the ListBox control requires usage of <i>LB_GETCURSEL</i> and <i>LB_GETTEXT</i>. With time, the library of macros in nsDialogs.nsh will fill with more and more macros that'll handle more cases like this.</p>
|
||||
|
||||
|
@ -370,6 +372,14 @@ Section
|
|||
|
||||
SectionEnd</pre></blockquote>
|
||||
|
||||
<h3><a name="helpful-macros"></a>Helpful macros</h3>
|
||||
|
||||
<h4><a name="set-focus">Set focus to a control</h4>
|
||||
|
||||
<p>Use the following syntax to set the focus to a specified control.</p>
|
||||
|
||||
<p><code>${NSD_SetFocus} <i>hwnd_of_control</i></code></p>
|
||||
|
||||
<h2><a name="ref"></a>Function Reference</h2>
|
||||
|
||||
<h3><a name="ref-create"></a>Create</h3>
|
||||
|
@ -410,7 +420,7 @@ SectionEnd</pre></blockquote>
|
|||
|
||||
<p>Displays a directory selection dialog to the user.</p>
|
||||
|
||||
<p>Returns the selected directory on the stack or "error" in case the user canceled the operation or an error occured.</p>
|
||||
<p>Returns the selected directory on the stack or an empty string if the user canceled the operation.</p>
|
||||
|
||||
<h3><a name="ref-setrtl"></a>SetRTL</h3>
|
||||
|
||||
|
|
|
@ -216,6 +216,10 @@ Header file for creating custom installer pages with nsDialogs
|
|||
!define __NSD_Text_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}
|
||||
!define __NSD_Text_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
|
||||
|
||||
!define __NSD_Password_CLASS EDIT
|
||||
!define __NSD_Password_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_PASSWORD}
|
||||
!define __NSD_Password_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
|
||||
|
||||
!define __NSD_FileRequest_CLASS EDIT
|
||||
!define __NSD_FileRequest_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}
|
||||
!define __NSD_FileRequest_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE}
|
||||
|
@ -250,6 +254,7 @@ Header file for creating custom installer pages with nsDialogs
|
|||
!insertmacro __NSD_DefineControl CheckBox
|
||||
!insertmacro __NSD_DefineControl RadioButton
|
||||
!insertmacro __NSD_DefineControl Text
|
||||
!insertmacro __NSD_DefineControl Password
|
||||
!insertmacro __NSD_DefineControl FileRequest
|
||||
!insertmacro __NSD_DefineControl DirRequest
|
||||
!insertmacro __NSD_DefineControl ComboBox
|
||||
|
@ -290,6 +295,22 @@ Header file for creating custom installer pages with nsDialogs
|
|||
|
||||
!define NSD_GetText `!insertmacro __NSD_GetText`
|
||||
|
||||
!macro __NSD_GetState CONTROL VAR
|
||||
|
||||
SendMessage ${CONTROL} ${BM_GETSTATE} 0 0 ${VAR}
|
||||
|
||||
!macroend
|
||||
|
||||
!define NSD_GetState `!insertmacro __NSD_GetState`
|
||||
|
||||
!macro __NSD_SetFocus HWND
|
||||
|
||||
System::Call "user32::SetFocus(i${HWND})"
|
||||
|
||||
!macroend
|
||||
|
||||
!define NSD_SetFocus `!insertmacro __NSD_SetFocus`
|
||||
|
||||
!define DEBUG `System::Call kernel32::OutputDebugString(ts)`
|
||||
|
||||
!macro __NSD_ControlCase TYPE
|
||||
|
@ -374,6 +395,7 @@ Header file for creating custom installer pages with nsDialogs
|
|||
!insertmacro __NSD_ControlCase CheckBox
|
||||
!insertmacro __NSD_ControlCase RadioButton
|
||||
!insertmacro __NSD_ControlCase Text
|
||||
!insertmacro __NSD_ControlCase Password
|
||||
!insertmacro __NSD_ControlCaseEx FileRequest
|
||||
!insertmacro __NSD_ControlCaseEx DirRequest
|
||||
!insertmacro __NSD_ControlCase ComboBox
|
||||
|
@ -397,9 +419,20 @@ Header file for creating custom installer pages with nsDialogs
|
|||
|
||||
${For} $R1 1 $R0
|
||||
ReadINIStr $R2 $0 "Field $R1" HWND
|
||||
${DEBUG} " HWND = $R2"
|
||||
${NSD_GetText} $R2 $R2
|
||||
${DEBUG} " Window text = $R2"
|
||||
ReadINIStr $R3 $0 "Field $R1" "Type"
|
||||
${Switch} $R3
|
||||
${Case} "CheckBox"
|
||||
${Case} "RadioButton"
|
||||
${DEBUG} " HWND = $R2"
|
||||
${NSD_GetState} $R2 $R2
|
||||
${DEBUG} " Window selection = $R2"
|
||||
${Break}
|
||||
${CaseElse}
|
||||
${DEBUG} " HWND = $R2"
|
||||
${NSD_GetText} $R2 $R2
|
||||
${DEBUG} " Window text = $R2"
|
||||
${Break}
|
||||
${EndSwitch}
|
||||
WriteINIStr $0 "Field $R1" STATE $R2
|
||||
${Next}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue