Archive: How disable text component


How disable text component
Hello

I have checkbox and text components.
How I can disable text component when checkbox changed status (checked)?

Thank you.

;;;;;;;;;;;;;;
;NSIS Modern User Interface version 1.63
;InstallOptions Example Script
;Written by Joost Verburg

!define MUI_PRODUCT "Xpress Systems TimeReports Client" ;Define your own software name here
!define MUI_VERSION "01.01.03.00" ;Define your own software version here

!include "MUI.nsh"

!define TEMP $R0

;--------------------------------
;Configuration

;General
OutFile "InstallOptions.exe"

;Folder selection page
InstallDir "$PROGRAMFILES\Xpress Systems\XSTRClient"

;Remember install folder
;InstallDirRegKey HKCU "Software\${MUI_PRODUCT}" ""

;--------------------------------
;Modern UI Configuration

!define MUI_CUSTOMPAGECOMMANDS

; !define MUI_LICENSEPAGE
!define MUI_COMPONENTSPAGE
!define MUI_DIRECTORYPAGE

!define MUI_ABORTWARNING

!define MUI_UNINSTALLER
!define MUI_UNCONFIRMPAGE

;--------------------------------
;Pages

; !insertmacro MUI_PAGECOMMAND_LICENSE
Page custom SetCustomA
Page custom SetCustomB
!insertmacro MUI_PAGECOMMAND_COMPONENTS
!insertmacro MUI_PAGECOMMAND_DIRECTORY
Page custom SetCustomC
!insertmacro MUI_PAGECOMMAND_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Language Strings

;Description
LangString DESC_SecCopyUI ${LANG_ENGLISH} "Copy the XSTRClient.exe file to the application folder."

LangString DESC_SecStartMenuShortcuts ${LANG_ENGLISH} "Create start menu shortcuts."
LangString DESC_SecDesktopShortcut ${LANG_ENGLISH} "Create desktop shortcut."

;Header
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "InstallOptions Page"
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "Create your own dialog!"

;--------------------------------
;Data

; LicenseData "${NSISDIR}\Contrib\Modern UI\License.txt"

;--------------------------------
;Reserve Files

;Things that need to be extracted on first (keep these lines before any File command!)
;Only useful for BZIP2 compression

ReserveFile "ioA.ini"
ReserveFile "ioB.ini"
ReserveFile "ioC.ini"
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

;--------------------------------
;Installer Sections

Section "TimeReports Client (required)" SecCopyUI
SectionIn RO

;Add your stuff here

; ;Read a value from an InstallOptions INI File
; !insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "ioC.ini" "Field 2" "State"
; StrCmp ${TEMP} "1" "" +2
; ;Checked
; MessageBox MB_OK "A MessageBox..."

!insertmacro MUI_INSTALLOPTIONS_READ ${TEMP} "ioA.ini" "Field 8" "State"
MessageBox MB_OK ${TEMP}


;;;;;;;;;;;;;;;;;;;
; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File "..\XSTRClient.exe"
File "..\XSTRClient.ini"
File "..\XSTRClient.rav"
File "..\XSTRClient.dsn"

MessageBox MB_YESNO|MB_ICONQUESTION "Install new database (Yes) or to keep existing database (No)?" IDYES NewDB IDNO NoDelete
NewDB:
File "..\XSTRClient.mdb"
WriteINIStr "$INSTDIR\XSTRClient.dsn" "ODBC" "DefaultDir" "$INSTDIR"
WriteINIStr "$INSTDIR\XSTRClient.dsn" "ODBC" "DBQ" "$INSTDIR\XSTRClient.mdb"
MessageBox MB_OK "NewDB"
goto AfterDB

NoDelete:
MessageBox MB_OK "NoDelete"

AfterDB:

; Write path to .dsn file
WriteINIStr "$INSTDIR\XSTRClient.ini" "DB_VERSIONS" "LocalDBName" "$INSTDIR\XSTRClient.dsn"

; Write the installation path into the registry
WriteRegStr HKLM "SOFTWARE\Xpress Systems\XSTRClient" "Install_Dir" "$INSTDIR"

; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XSTRClient" "DisplayName" "Xpress Systems TimeReports Client (remove only)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XSTRClient" "UninstallString" '"$INSTDIR\uninstall.exe"'

;Create uninstaller
WriteUninstaller "uninstall.exe"
SectionEnd


Section "Start Menu Shortcuts" SecStartMenuShortcuts ; optional section (can be disabled by the user)
CreateDirectory "$SMPROGRAMS\TimeReports Client"
CreateShortCut "$SMPROGRAMS\TimeReports Client\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\TimeReports Client\TimeReports Client.lnk" "$INSTDIR\XSTRClient.exe" "" "$INSTDIR\XSTRClient.exe" 0
SectionEnd


Section "Desktop Shortcut" SecDesktopShortcut ; optional section (can be disabled by the user)
CreateShortCut "$DESKTOP\TimeReports Client.lnk" "$INSTDIR\XSTRClient.exe"
SectionEnd


;Display the Finish header
;Insert this macro after the sections if you are not using a finish page
!insertmacro MUI_SECTIONS_FINISHHEADER

;--------------------------------
;Descriptions

!insertmacro MUI_FUNCTIONS_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecCopyUI} $(DESC_SecCopyUI)

!insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenuShortcuts} $(DESC_SecStartMenuShortcuts)
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopShortcut} $(DESC_SecDesktopShortcut)
!insertmacro MUI_FUNCTIONS_DESCRIPTION_END

;--------------------------------
;Installer Functions

Function .onInit

;Extract InstallOptions INI Files
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioA.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioB.ini"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioC.ini"

FunctionEnd

;Function .onSelChange
;Push $R0

; Field 4 - Existing database
;GetDlgItem $R0 $HWNDPARENT 1203
; 0xA - WM_ENABLE
;SendMessage $R0 0xA 0 0
;MessageBox MB_OK ".onSelChange"

;Pop $R0
;FunctionEnd

Function SetCustomA
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"
FunctionEnd

Function SetCustomB
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"
FunctionEnd

Function SetCustomC
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioC.ini"
FunctionEnd

;--------------------------------
;Uninstaller Section

Section "Uninstall"

; remove registry keys
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XSTRClient" "DisplayName"
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\XSTRClient" "UninstallString"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\XSTRClient"
DeleteRegKey HKLM "SOFTWARE\Xpress Systems\XSTRClient"

; remove files and uninstaller
Delete $INSTDIR\XSTRClient.exe
Delete $INSTDIR\XSTRClient.ini
Delete $INSTDIR\XSTRClient.rav
Delete $INSTDIR\XSTRClient.dsn

Delete $INSTDIR\XSTRClient.mdb

Delete $INSTDIR\uninstall.exe

; remove shortcuts, if any
Delete "$SMPROGRAMS\TimeReports Client\*.*"

; remove directories used
RMDir "$SMPROGRAMS\TimeReports Client"

; remove desktop icon
Delete "$DESKTOP\TimeReports Client.lnk"

RMDir "$INSTDIR"

!insertmacro MUI_UNFINISHHEADER

SectionEnd

;;;;;;;;;;;;;;


Please attach scripts and post only relevant code.

Are you talking about an InstallOptions page? There is currently no way to disable controls depending on others.