How to create NSD_Text dynamically depending from a NSD_CheckBox?

StackOverflow https://stackoverflow.com/questions/22498852

  •  17-06-2023
  •  | 
  •  

Вопрос

I want to create a Textinput for the User dynamically depending from the State of a Checkbox above it.

I tried something like this:


...

Function nsDialogsPage
     nsDialogs::Create 1018
     ${NSD_CreateCheckBox} 20u 55u 50% 20u "Download with Proxy"
     Pop $testBox
     ${NSD_OnClick} $testBox button_click
     nsDialogs::Show
FunctionEnd

Function button_click
     ${NSD_GetState} $testBox $6
     ${If} $6 == 1
     ${NSD_CreateText} 20u 75u 80% 25p "Enter your Proxy ..."
     ${Else} 
     ;Remove the Text, Set it invisible or do something like this ...
     ${EndIf}
FunctionEnd

Function nsDialogsPageLeave
     ;does something with the input
FunctionEnd 

I didn't find anything on http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html and I dont know how to remove the Box or make it invisible for the User or something like this, that he can't enter anything when the CheckBox is unchecked.

Это было полезно?

Решение

Take a look at EnableWindow

${NSD_CreateText} 20u 75u 80% 25p "Enter your Proxy ..."
Pop $myText

#disable control
EnableWindow $myText 0

#enable control
EnableWindow $myText 1

#hide control
ShowWindow $myText 0

#show control
ShowWindow $myText 1
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top