Skip to content
⌘ NSIS Forum Archive

MUI_INSTALLOPTIONS_WRITE problems with writing to text field

6 posts

NEHOG#

MUI_INSTALLOPTIONS_WRITE problems with writing to text field

I have the following code in my validate page function. I read the email address OK, but can't set it to anything when the user's entered values don't match. (Var $EmailData is the value entered in the main email text box, $R0 is the 'verify email' text box value.) I wanted to set the Field 9 text to blank, but nothing I do with MUI_INSTALLOPTIONS_WRITE affects the given controls.

 
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "..\email.ini" "Field 9" "State"


MessageBox MB_ICONEXCLAMATION|MB_OK "email is $EmailData Confirm email is: $R0"

StrCmp $EmailData $R0 Same NotSame

NotSame:

MessageBox MB_ICONEXCLAMATION|MB_OK "Your e-mail addresses do not match. Please re-enter."

!insertmacro MUI_INSTALLOPTIONS_WRITE "..\email.ini" "Field 1" "State" "Your name here."
!insertmacro MUI_INSTALLOPTIONS_WRITE "..\email.ini" "Field 2" "State" "Your email here."
!insertmacro MUI_INSTALLOPTIONS_WRITE "..\email.ini" "Field 9" "State" "Confirm email here."
I know... Doing something dumb!

(Text in the example MUI_INSTALLOPTIONS_WRITE is for example only, final version will write an empty string to the Field 2 one only)
NEHOG#
Originally posted by Afrow UK
You are writing to $PLUGINSDIR\..\email.ini. That the correct file?

Stu
Yes, it that is correct. And the line:

!insertmacro MUI_INSTALLOPTIONS_READ $R0 "..\email.ini" "Field 9" "State"
Works OK (it correctly fetches the value the user entered in the field), only the ..._WRITE is not working as expected.

Initially I thought maybe it wasn't updating the screen, but it seems to not to have any effect at all. (really odd!)
Red Wine#
When the dialog is already displayed you have to SendMessage to the field that you want to change.
NEHOG#
Originally posted by Red Wine
When the dialog is already displayed you have to SendMessage to the field that you want to change.
Wouldn't have any sample code, would you? 🙂