justme123
12th October 2009 12:31 UTC
MUI Finish page - how to show 'show readme' and 'reboot' at the same time
Hi,
i'm creating an installer that requires a reboot and i want to add a checkbox to the finish page that allows to create a shortcut.
In the main section there is "SetRebootFlag true" and the finish page is created with
!define MUI_FINISHPAGE_SHOWREADME
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION createDesktopShortcut
!define MUI_FINISHPAGE_REBOOTLATER_DEFAULT
!insertmacro MUI_PAGE_FINISH
But the finish page only displays the reboot radiogroup.
If i disable reboot support with '!define MUI_FINISHPAGE_NOREBOOTSUPPORT', it shows the checkbox.
I checked Contrib\Modern UI 2\Pages\Finish.nsh and it looks like the calculations for positioning the reboot radiogroup doesn't take the option checkboxes (readme / run) into account.
Is there any way to reorganize the boxes without changing Finish.nsh?
regards,
justme123
jpderuiter
12th October 2009 15:13 UTC
This post should get you started:
http://forums.winamp.com/showthread....hreadid=264181
justme123
12th October 2009 16:57 UTC
Thanks for the pointer to that Thread. Reads like it's what i need.
Unfortunatly it doesn't seem to do the trick with MUI2's finish page and reboot.
Maybe i'm using the wrong fieldindex?
I assume there are 5 fields in a finish page (image, header,text,rebootnow,rebootlater) so using field 6 as in that example should work, but it does not :/
As a workaround, i've created a new custom page with a checkbox for the shortcut. Overkill for a single checkbox, but it looks like there are more to come anyways.
ps. i know about sections/components, but the components page layout is a bit cluttered. If anyone knows how to strip it down to just a list of checkboxes (no description pane that eats half the horizontal space, no additional border) i'd be happy to use that.
tom_q
26th June 2013 15:46 UTC
As it stands, there is still no way (that I know of) to fix this in MUI.
I understand the rationale of hiding readme and run program in case of a reboot. However this could have been worked around by launching the program or showing the readme after the reboot (registry, runonce).
Besides, since these buttons are hidden, any other use of the checkboxes (e.g. for links) is also made impossible when a reboot is needed.
I'm currently looking towards manually designing the entire finish page with nsdialogs instead. Does anyone know of a fix that involves less work?
Anders
26th June 2013 18:06 UTC
You can add your own controls in MUI2 in the show callback for the finish page...
jpderuiter
26th June 2013 22:10 UTC
Yes, see here for an example.
tom_q
4th July 2013 09:29 UTC
Thanks! Will do that.
Edit: sorry for coming back again so soon... I tried the proposed solution; I first tried adapting it to my code, and when this didn't work I copied what Anders posted on StackOverflow (slightly simplified here):
var Checkbox
Function MyFinishShow
${NSD_CreateCheckbox} 120u 110u 100% 10u "Something"
Pop $Checkbox
FunctionEnd
!define MUI_PAGE_CUSTOMFUNCTION_SHOW MyFinishShow
!insertmacro MUI_PAGE_FINISH
This compiles fine but crashes on execution when the finish page loads ("... has stopped responding").
Based on messagebox debugging, the crash occurs on this specific line:
${NSD_CreateCheckbox} 120u 110u 100% 10u "Something"
The same thing happens when using a Label instead of CheckBox. I'll keep working on it if/when I find time, although I'll probably go for rewriting the finish page. But if anyone has another solution (or figures out why my code doesn't execute properly) it will be much appreciated! Additional info: using NSIS 2.46.
... Alternatively, if anyone knows how to include new lines in the finish page label, that could also help me (that way I would just change the label text instead of adding a label). Setting MUI_FINISHPAGE_TEXT works for text... but anything that follows a "$\n" isn't shown (I don't know what to attribute this to; maybe the label height is not correctly set when there are newlines? The finish page label shows very long wrapped text string just fine). "$\n" works fine in message boxes or custom page labels.
tom_q
4th July 2013 17:27 UTC
Problem solved. I was still including MUI.nsh instead of MUI2.nsh, hence the crash.
Thanks again everyone.