Archive: mui2 custom page with variables


mui2 custom page with variables
Hi all,

I'm trying to implement a custom mui2 page which knows some variables, something like e.g. the existing directory page but instead of filling a path variable I want to e.g. fill a boolean variable which tells me if a checkbox has been selected. The aim is to be ready to use this page multiple times just doing something like
!define MUI_CHECKBOXPAGE_VARIABLE ${enableA}
!define ... (some text things)
!insertmacro MUI_PAGE_CHECKBOX

!define MUI_CHECKBOXPAGE_VARIABLE ${enableB}
!define ... (some text things)
!insertmacro MUI_PAGE_CHECKBOX

I tried so by various ways: Just defining my custom page with a function accessing the MUI_CHECKBOXPAGE_VARIABLE I get a problem when filling MUI_CHECKBOXPAGE_VARIABLE in the "leave" function, probably because at include time the !define line was not yet passed? So I tried to copy everything from the directory page. There is some page declaration done within a macro so my hope is that MUI_CHECKBOX_PAGE_VARIABLE must be available only at the time of using the macro. But when filling it with StrCpy "${MUI_CHECKBOXPAGE_VARIABLE}" "True" I get a usage error for StrCpy. Same when changing it a bit like for the existing startmenu page where the variable is provided as parameter like

!insertmacro MUI_PAGE_CHECKBOX ${enableA}

Any ideas how I can create a flexible custom page that accepts variables defined before using its insertmacro?


Maybe the problem can be tracked down to problems with code like this

Var bar

...

!macro foo out
StrCpy "${out}" "bar"
!macroend

...

foo $bar

From the error message it seems that out is not considered being an output variable in the StrCpy line.


You can pass variables to macros. At the end of the day, any constants are evaluated. It is after evaluation that syntax is checked. Therefore, your code in the 2nd post above (should) work.

However, !define MUI_CHECKBOXPAGE_VARIABLE ${enableA}. Is that Var enableA? In which case it should be $enableA not ${enableA} or is there something I am missing.

Stu