Archive: Needs help with Custom Page creation


Needs help with Custom Page creation
As I'm newbie in custom pages creation, I need a little help - how to put two checkboxes in MUI_PAGE_DIRECTORY and two checkboxes in MUI_UNPAGE_CONFIRM
Thanks


1. You need to edit your user interface exe file (e.g. modern.exe) with Resource Hacker and put two check-boxes on there that way. You'd then need to get the state of the check-boxes using SendMessage $hwnd 0x00F2 0 0 $R0 ($R0 = 1 or 0 / checked or unchecked).

2. You need to modify the Modern UI ioSpecial.ini file on uninstall and add two check-box fields.

-Stu


It seems that I understood: dialogs 103 (for MUI_PAGE_DIRECTORY) and 107 (for MUI_UNPAGE_CONFIRM) in modern.exe (imho it's easiest way for newbies). But how to change text near this checkboxes (installer will be multilinguale). Am I need to use ioSpecial.ini or it can be done by another way?


Sorry, for some reason I though uninstConfirm was a Modern UI custom dialogue (which it isn't).

You just need to add the check-boxes on the dialogues with Resource Hacker.
Right click on the dialogue, Insert Control, select Checkbox icon, and enter a Caption.

Now, you'll have something like this in the script:
CONTROL "blah", 0, BUTTON, BS_CHECKBOX...

You need to replace 0 (the control's item ID) with a unique number like 7. 0, 1 and 2 have been used for the Back, Next and Cancel buttons, so you can't use them again. 7 and 8 hasn't been used for anything, so use 7 for your first check-box and 8 for the second. On your uninstConfirm page put two on there with id's of 9 and 10.

Now, to find out if one of them is checked, you need to use this in the page's Leave function (use !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "funcName" before inserting the MUI_PAGE macro's)...


FindWindow $R1 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R1 7
SendMessage $R0 0x00F2 0 0 $R0
StrCmp $R0 0 +2
MessageBox MB_OK "It's checked" IDOK +2
MessageBox MB_OK "It's NOT checked" IDOK +2


-Stu

This might sound a little dumb, but wouldn't it be just as easy to create custom pages using InstallOptions?


Thanks, Afrow UK! (but I think it must be CONTROL "blah", 0, BUTTON, BS_AUTOCHECKBOX...)
Just another little question: How to change caption of that checkboxes at runtime, using LangString ... ${LANG_ENGLISH} "..." or maybe other command, based on chosen language.
And how to change default state (checked\unchecked)? Now by default they are both unchecked.


To change the captions use:
FindWindow $R1 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R1 7
SendMessage $R0 0xC 0 "STR:$(LANG_SRING)"

Now to check or uncheck check-box #7, use:
SendMessage $R0 0x00F1 1 0 ;check
SendMessage $R0 0x00F1 0 0 ;uncheck

You need to put these in the Show page function.

-Stu


Thanks again.
I want to add such behavior: If user checks button "#8"
- then button "#7" must be automatically checked too. I wrote this code but I don't know where to put it. Maybe I need another code...


FindWindow $R1 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R1 8
SendMessage $R0 0x00F2 0 0 $R0
StrCmp $R0 "0" +4
FindWindow $R1 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R1 7
SendMessage $R0 0x00F1 1 0

I'm afraid that isn't possible. You can't assign a custom function to a control without modifying and recompiling NSIS's source code.

-Stu


MUI_UNPAGE_CONFIRM can be easily emulated with InstallOptions and InstallOptions can notify you when buttons are clicked. The directory page will be harder to emulate, but it's possible if you're willing to make some sacrifices.