Archive: help reading field values on ModernUI


help reading field values on ModernUI
Hello,

I've been struggling with reading the values from some fields i have on a custom dialog using the Modern UI.

Here is the ini content (Tester.ini):
[Settings]
NumFields=1

[Field 1]
Type=CheckBox
Left=15
Right=-12
Top=3
Bottom=18
Text=Enabled Blah


Here are some script snippets that deal with this dialog:
;include custom page
Page Custom ShowDlg LeaveDlg

;initialization
Var DLG_INI
Function .onInit
InitPluginsDir
GetTempFileName $DLG_INI $PLUGINSDIR
File /oname=$DLG_INI "Tester.ini"
FunctionEnd

Function ShowDlg
InstallOptions::initDialog /NOUNLOAD "$BMS_DLG_INI"
InstallOptions::show
FunctionEnd

Function LeaveDlg
!insertmacro MUI_INSTALLOPTIONS_READ $0 "Tester.ini" "Field 1" "State"
MessageBox MB_OK "Value: $0"
FunctionEnd


As you can see this is a very simple example. Im using the MUI_INSTALLOPTIONS_READ macro but it never pulls the value in. MessageBox never displays a value. From what i've read, this script seems correct. Is there something im missing? or is there an alternative way of reading the values from the fields.

Thanks very much for the help. :)


If you're not using the MUI macros to extract and show the INI file, don't use the MUI macros to read and write from the file. Use ReadINIStr instead.


sweet that worked perfect.. thanx for the help mon.
should i be using the mui macros as opposed to how im doing it now? if so, can you give me an example of how the script would change to use mui macros instead?
thanx again.


When using the MUI, you should use the MUI macros to handle custom InstallOptions pages as it does some things behind the scenes for you so they'll come up more MUI-like. An example is available in the Examples\Modern UI directory.