azzzrail
4th October 2007 14:51 UTC
Check to continue
Hi there,
I want the user to confirm that he has read some warningtext before the installation continues.
i tried to use the notify flag with the mui but it doesn't seem to work somehow.
Here's the code
insertmacro MUI_INSTALLOPTIONS_READ $0 "warnings.ini" "Settings" "State"
${if} $0 == 1
!insertmacro MUI_INSTALLOPTIONS_READ $3 "warnings.ini" "Field 2" "State"
${if} $3 == 1
GetDlgItem $R2 $HWNDPARENT 1
EnableWindow $R2 1
${else}
GetDlgItem $R2 $HWNDPARENT 1
EnableWindow $R2 0
${endif}
abort
!insertmacro MUI_INSTALLOPTIONS_READ $2 "warnings" "Field 2" "HWND"
SendMessage $2 ${BM_SETCHECK} 0 0
abort
${endif}
i almost completly copied the code for the manual,only changing the commands for using the mui.
the example code disables the next button until the checkbox is checked. after clicking the next button the installer continues. in my example the installer directly continues after clicking the checkbox, which isn't supposed to happen.
Any ideas?
kichik
4th October 2007 15:10 UTC
You're calling Abort in the wrong places. You must always call abort if [Settings]\STATE is set. If you don't, it'll skip to the next page.
azzzrail
4th October 2007 15:23 UTC
hmm. this doesn't seem to work either.
i now use the abort command when the checkbox is set
${if} $3 == 1
GetDlgItem $R2 $HWNDPARENT 1
EnableWindow $R2 1
abort
and it still skip to the next page.
am i getting you wrong?
kichik
4th October 2007 15:27 UTC
Yes, you're getting me wrong. You must always call Abort. This shouldn't depend on whether the checkbox is checked or not, but only on [Settings]\STATE. If STATE is set, the leave function is called because the user did something to a control with the NOTIFY flag. If you fail to call Abort in this case, it'll move to the next page.
azzzrail
4th October 2007 16:03 UTC
ok. now i understand what you mean. i have to call abort in the settings/state branch to stop the leave function from skipping to the next page. but this doesn't work either. it still skips to the next page. abortning after the ${endif} of the state branch results in leaving the next button disabled.
maybe i got my stupid day but really can't figure it out, or maybe i'm still getting you wrong.
could you perhabs edit my code example to be sure?
kichik
4th October 2007 16:08 UTC
Seems like the problem is in the first ${If}. You check if [Settings]\STATE is 1, but then check the state of Field 2. If your checkbox is Field 2, you should check for 2 in the first ${If}.
azzzrail
4th October 2007 16:18 UTC
omfg.. yeah that's it. thx. especially for your patience.