Archive: fancy checkboxes with ButtonEvent plugin


fancy checkboxes with ButtonEvent plugin
I just discovered this ButtonEvent plugin which somehow didn't make it to the official distribution

From what I read I need to do all sorts of hacks like modifying the ui executable with resource hacker. A bit roundabout :)

What i'm trying to do is something similar to .onSelChange
handler but NOT in components page. I have a custom page with a main checkbox and 2 "subcomponents", so I want to disable the subcomponents if the main checkbox is cleared, and turn them back on if it is checked. This kind of live update is it possible with ButtonEvent? I shouldn't need to mess with resource hacker i hope?

thanks
nikos


If you use nsDialogs for your custom page then you just assign a click event. If you use Install Options then set the NOTIFY flag as described in the readme.

Stu


you're getting too technical for my level :)
I'm adding the page with

Page custom TBundle

so what am I using?


I cannot read your mind! It depends what you have used in your TBundle function. Either InstallOptions or nsDialogs.

Stu


so as I'm using MUI_INSTALLOPTIONS_DISPLAY then I have to use the /NOTIFY approach, ie add an event handler for the main checkbox, which will call the pageleave function whenever there's an "event".

I take it that all WM_COMMAND messages sent by the checkbox will trigger the handler?

at least there's no need for resource hacker!


if you are using InstallOptions(2/Ex), then - besides reading its documentation - all you need to do is add the "NOTIFY" flag to the checkbox's definition in the .ini file that defines the dialog. e.g.


[Field 6]
Type=Checkbox
Text=Hello World
Flags=RIGHT|NOTIFY


Then when the custom page's Leave function is called, check the InstallOptions exit code. It writes this into the ini in the group "Settings", key "State". E.g.

!insertmacro MUI_INSTALLOPTIONS_READ $0 "custom.ini" "Settings" "State"


Now $0 contains the exit code. If that exit code is 0 (zero), the user pressed the Next button. If the exit code is 6, then the user interacted with Field 6 - which in the case of a checkbox means either having checked it or unchecked it. You'll then need further code to check the State key of Field 6 to see whether it got checked or unchecked.