Archive: Check Back, Next, Cancel Button in Custom Page


Check Back, Next, Cancel Button in Custom Page
Hi,

i´ve a custom page with notify events. This works fine. But I need to determine if one of the buttons "Next, Beck or Cancel" where pressed. Without notifications I can use

----
!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "ioB.ini"
----
But with notifications I can´t use this. My Custom Page looks like this. It based on the notifytest example:

-----------
Function .onInit
;Extract InstallOptions INI Files
InitPluginsDir
File /oname=$PLUGINSDIR\ioB.ini "ioB.ini"
FunctionEnd

Page custom Internetverbindungsart LeaveInternetverbindungsart

Function Internetverbindungsart
!insertmacro MUI_HEADER_TEXT "Internetverbindungsart" "Wählen Sie die entsprechende Internetverbindungsart."

InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\ioB.ini"
Pop $hwnd
InstallOptions::show
Pop $0
FunctionEnd

Function LeaveInternetverbindungsart

ReadINIStr $0 "$PLUGINSDIR\ioB.ini" "Field 2" "State"
GetDlgItem $1 $hwnd 1204 ; PathRequest control (1200 + field 5 - 1)
EnableWindow $1 $0
WriteINIStr "$PLUGINSDIR\ioB.ini" "Field 5" "State" $0
Abort
FunctionEnd
--------------------

In the Function "LeaveInternetverbindungsart" I must determine which buttons where pressed. How is it possible?

Best Regards

Rainer



Top:
InstallOptions::dialog "$PLUGINSDIR\ioB.ini"
Pop $0
StrCmp $0 "back" 0 +2
MessageBox MB_OK "Back" IDOK Top
StrCmp $0 "next" 0 +2
MessageBox MB_OK "Next" IDOK Top
StrCmp $0 "cancel" 0 +2
MessageBox MB_OK "Cancel" IDOK Top


It's in the IO readme if you read it.

-Stu

Hi,

thanks for your answer. I´ve two Radio Buttons in the page. If one is checked an edit field must be enabled. If the other is checked the edit field must by disabled. At the moment I do this in the LeaveFunction. But this should only be used if one of this button (next, back, cancel) doesn´t pressed. Additionally I want to validate the edit field (But I doesn´t do it in the Leave Function).

I can´t differ it and i don´t know where i must differ it?

I´ve modified my code and here is the actually version. See the first line in the function "LeaveInternetverbindungsart":

----
Page custom Internetverbindungsart LeaveInternetverbindungsart
----

---- Validation ----
Function Internetverbindungsart
again:
!insertmacro MUI_HEADER_TEXT "Internetverbindungsart" "Wählen Sie die entsprechende Internetverbindungsart."
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioB.ini"
Pop $hwnd
!insertmacro MUI_INSTALLOPTIONS_SHOW_RETURN
Pop $R0 ; Rückgabewert holen

; MessageBox MB_ICONINFORMATION|MB_OK $R0

StrCmp $R0 "back" donevalidate
StrCmp $R0 "success" dovalidate
StrCmp $R0 "cancel" donevalidate

MessageBox MB_ICONINFORMATION|MB_OK "Nix gedrückt"

dovalidate:
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "ioB.ini" "Field 2" "State"
StrCmp $R1 1 validateit donevalidate

validateit:
!insertmacro MUI_INSTALLOPTIONS_READ $R2 "ioB.ini" "Field 5" "State"
StrCmp $R2 "" showmessage donevalidate
showmessage:
MessageBox MB_ICONINFORMATION|MB_OK 'Wenn Sie die Option "Dial-Up" gewählt haben, dann müssen Sie einen Host $\n$\r(z.B. www.t-online.de oder www.yahoo.de) zum Pingen eintragen!'
goto again

donevalidate:

FunctionEnd

---- Notify Events for the dialogs -----
Function LeaveInternetverbindungsart
---> At this point I don´t know if the button is pressed
Pop $0

StrCmp $0 "back" donevalidate
StrCmp $0 "success" donevalidate
StrCmp $0 "cancel" donevalidate

checkwindow:
ReadINIStr $0 "ioB.ini" "Field 2" "State"
GetDlgItem $1 $hwnd 1204 ; PathRequest control (1200 + field 5 - 1)
EnableWindow $1 $0
WriteINIStr "ioB.ini" "Field 5" "State" $0
Abort

donevalidate:
FunctionEnd
----------------


Thanks

Rainer