Archive: Using ModernUI checkbox optionally


Using ModernUI checkbox optionally
Hi there, and thanks for reading.

My NSIS script uses ModernUI, and takes advantage of the feature that enables a checkbox to display on the finish page:

; Adding a checkbox at the last page
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Run Configuration Wizard"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchSPConfig"
!define MUI_FINISHPAGE_RUN_NOTCHECKED
!define MUI_PAGE_CUSTOMFUNCTION_SHOW SetFinishPageOptions

!insertmacro MUI_PAGE_FINISH

My problem is that I only want the checkbox option to be there if a certain component was installed. If that component wasn't installed, I just want a blank finish screen. I was able to use SectionGetFlags to tell if the component's been installed, but can't figure out how to use that information to control display of the checkbox.

I have searched and tried, but have not come up with a way to conditionally take advantage of this feature. Is there any way to do this?

Thanks!

-Ian


You can write the ini file yourself. Get the state by using "SectionGetFlags": If the section is selected, write the ini file to create a checkbox control; If not selected, do nothing.

In the function ".onInstSuccess" to read the state of the checkbox control: If the state is 1, run the application you want; If the value is 0 or null, do nothing.

But I think it is not a good idea.


If you are using MUI 2 then you simply need to use ShowWindow $mui.FinishPage.Run ${SW_HIDE} in a custom show function.

Stu


Thanks for the feedback!
Writing my own ini file loses the look-and-feel integration of the Modern UI, and certainly is a huge pain, but it's good to know the option exists.
I'm not using MUI 2, but maybe this is a good reason to switch!
In the meantime, I've gotten around the problem by getting rid of the checkbox and adding a MessageBox in MUI_PAGE_CUSTOMFUNCTION_LEAVE instead; at least that gives me control over whether or not to display it.

Again; thanks much!