Archive: Directory page has install button always disabled.


Directory page has install button always disabled.
Hi:
I have below logic for Directory page.
This implementation keeps the Install button disabled.


!define SHACF_FILESYSTEM 1

Function nsDialogsDirectory

!insertmacro MUI_HEADER_TEXT "Choose Install Location" "Choose the folder in which to install $(^NameDA)."

GetDlgItem $0 $HWNDPARENT 1
EnableWindow $0 0

nsDialogs::Create 1018
Pop $DIALOG
DetailPrint 'Path: "$DIALOG"'
#nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP} 0 0 0 109u 193u ""
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP}0 120u 32u -130u -32u
Pop $IMAGECTL
StrCpy $0 $PLUGINSDIR\welcome.bmp
System::Call 'user32::LoadImage(i 0, t r0, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s'
Pop $IMAGE

SendMessage $IMAGECTL ${STM_SETIMAGE} ${IMAGE_BITMAP} $IMAGE

nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_CENTER} 0 0 0 100% 30 "Directory page"
Pop $HEADLINE

SendMessage $HEADLINE ${WM_SETFONT} $HEADLINE_FONT 0

#nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 30 100% 40 "Select the installation directory of NSIS to continue. $_CLICK"
nsDialogs::CreateControl STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${SS_BITMAP}0 120u 32u 100% 40 "Select the installation directory of NSIS to continue. $_CLICK"
Pop $TEXT
SetCtlColors $DIALOG "" 0Xff00ff
SetCtlColors $HEADLINE "" 0Xff00ff
SetCtlColors $TEXT "" 0Xff00ff

nsDialogs::CreateControl EDIT ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${ES_AUTOHSCROLL}|${WS_TABSTOP} ${WS_EX_CLIENTEDGE} 0 75 100% 12u "$PROGRAMFILES\EMDK for C V1.2\"
Pop $DIRECTORY

SendMessage $HWNDPARENT ${WM_NEXTDLGCTL} $DIRECTORY 1

GetFunctionAddress $0 DirChange
nsDialogs::OnChange $DIRECTORY $0

System::Call shlwapi::SHAutoComplete(i$DIRECTORY,i${SHACF_FILESYSTEM})


;Call HideControls

nsDialogs::Show

;Call ShowControls




${NSD_OnChange} $Directory DirChange

FunctionEnd




Function DirChange

Pop $0 # dir hwnd
DetailPrint 'Path: "$0"'

GetDlgItem $0 $HWNDPARENT 1

System::Call user32::GetWindowText(i$DIRECTORY,t.d,i${NSIS_MAX_STRLEN})

${If} ${FileExists} $INSTDIR\makensis.exe
EnableWindow $0 1
${Else}
EnableWindow $0 0
${EndIf}

#Call UpdateFreeSpace

FunctionEnd


How do I have install button enabled.


Add a MessageBox command to the if statement in DirChange. That way you know if makensis.exe is even found at all. Also check if $0 contains the proper HWND at that point.