Archive: dirpage plugin and UI interraction


dirpage plugin and UI interraction
After using the plugin dirpage with directory page, i test the string entered in the directory field and if the test is wrong, i want to simulate a click on the "back' button or if possible show the directory page again.

So my question is how to simulate a click on the back button or how to show the MUI_PAGE_DIRECTORY

I put the code here for more explication


!macro MUI_FUNCTION_DIRECTORYPAGE PRE SHOW LEAVE

Function "${PRE}"
StrCmp $MUI_INSTALL_ABORTED 1 0 +2
Abort

${If} $MUI_USE_MAINTENANCE_CMDLINE == "TRUE"
!ifdef MUI_SKIP_DIRECTORY_PAGE
Abort
!else
!ifdef MUI_DISABLE_FIRST_BACKBUTTON
GetDlgItem $MUI_TEMP1 $HWNDPARENT 3
EnableWindow $MUI_TEMP1 0
!undef MUI_DISABLE_FIRST_BACKBUTTON
!else ifdef MUI_HIDE_FIRST_BACKBUTTON
GetDlgItem $MUI_TEMP1 $HWNDPARENT 3
ShowWindow $MUI_TEMP1 0
!undef MUI_HIDE_FIRST_BACKBUTTON
!endif
!endif
${EndIf}

!insertmacro MUI_HEADER_TEXT_PAGE $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_DIRECTORY_TITLE) $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_DIRECTORY_SUBTITLE)

!ifdef MUI_USE_DIRPAGEDLL
# Variable for define the default instdir path
Var /GLOBAL DEFAULT_INSTDIR

${IF} $DEFAULT_INSTDIR == ""
StrCpy $DEFAULT_INSTDIR "$INSTDIR"
${ENDIF}

# if $instdir is empty, re-set the default path
${IF} $INSTDIR == ""
StrCpy $INSTDIR "$DEFAULT_INSTDIR"
${ENDIF}

InitPluginsDir
dirpage::show /noicon /spaceavailtext "%d: Total: %t\tFree: %f" /text "$(^DirBrowseText)" $INSTDIR
Pop $R0 ; Get result

StrCmp $R0 "success" ok
StrCmp $R0 "cancel" skip
MessageBox MB_OK "Dir Page error: $R0"
skip:
Return
ok:

;Pop $INSTDIR
pop $R1

${IF} $R1 == ""
; here the code for emulate the back button click
or showing the directory page
${ENDIF}

!else
!insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE
!endif
FunctionEnd

!ifndef MUI_USE_DIRPAGEDLL
Function "${SHOW}"
!insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW
FunctionEnd
!endif

Function "${LEAVE}"
!insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE
messagebox mb_ok "leave end"
FunctionEnd

!macroend



Thanks for your answer

You can't call that in the pre function of a page.
You can to call it in a custom page show function:

Page Custom CustomPageShow

Function CustomPageShow
...
FunctionEnd

Stu