Old 29th September 2005, 20:59   #1
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
Adding a checkbox to the MUI_WELCOME page

Hi all,

I am curious if anyone is aware of a way to add one component to a MUI page (specifically the MUI_WELCOME page). Basically, I want to add one checkbox at the bottom of the welcome page that says "Check online for updates". I could of course write a custom page just for that one checkbox, but I think it'd be cleaner to integrate it into the existing MUI welcome page.

I saw the following in the manual, and I will be testing out some ideas in a few minutes:

Quote:
MUI_WELCOMEFINISHPAGE_INI ini_file
InstallOptions INI file for the Welcome page and the Finish page.
Default: ${NSISDIR}\Contrib\Modern UI\ioSpecial.ini
But I don't want the "Check for updates" to show up on the finish page, just the welcome page. Well, if anyone has expertise in something like this, a basic shove in the right direction would be appreciated. Thanks
Jamyn is offline   Reply With Quote
Old 29th September 2005, 21:36   #2
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
I'm guessing the easiest way to do this would be to add a PRE and LEAVE function to the MUI_WELCOME page, with the PRE function adding the checkbox to the MUI_WELCOME InstallOptions file, and the LEAVE function editing it back out? Hmmm. I'll have to look at it when I get home.
Jamyn is offline   Reply With Quote
Old 30th September 2005, 22:05   #3
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
Example

(Picture attached)

PHP Code:
Function .onInit
    InitPluginsDir
        
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioSpecial.ini"
FunctionEnd

...

Function 
PageWelcomeUpdateCheckbox
    WriteINIStr 
"$PLUGINSDIR\ioSpecial.ini" "Settings" "NumFields" "4"
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Type" "Checkbox"
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Left" "120"
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Top" "170"
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Right" "250"
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Bottom" "180"
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Text" "Check for program updates?"
    
Bug?: The following line changes the checkbox to the right side (TRANSPARENT is invalid?)
    ;    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Flags" "NOTIFY|TRANSPARENT"
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "Flags" "NOTIFY"
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 4" "State" "1"
    
Field 3 overlaps the checkbox a littleshrink it.
    
WriteINIStr "$PLUGINSDIR\ioSpecial.ini" "Field 3" "Bottom" "169"
FunctionEnd

...

    !
define MUI_PAGE_CUSTOMFUNCTION_PRE "PageWelcomeUpdateCheckbox" Add update checkbox
    
!insertmacro MUI_PAGE_WELCOME

... 
(I need to write the exit function for MUI_WELCOME to work with the checkbox, but that's besides the point)

So far, things seem fine, with one caveat: The text with the checkbox does not have the same white background as the rest of the welcome page. Example picture attached.

Do I need to redraw the screen somehow? Is there a way to tell NSIS to use the same background for the checkbox as the rest of the welcome page? Any pointers would be greatly appreciated. I just have never tried to add additional components to an existing MUI page, so maybe I am missing something obvious. Anyway... any help or pointers would be greatly appreciated
Attached Images
File Type: gif welcome-checkbox.gif (1.8 KB, 420 views)

Last edited by Jamyn; 30th September 2005 at 22:35.
Jamyn is offline   Reply With Quote
Old 30th September 2005, 22:17   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Use SetCtlColors on the checkbox. Take a look at Contrib\Modern UI\System.nsh, it's done there a lot.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 30th September 2005, 22:33   #5
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
Thanks!

Thanks for the help sir!
Jamyn is offline   Reply With Quote
Old 2nd October 2005, 06:43   #6
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
Hmm. Well, I ran into a brick wall with one of two things (I've never tried to modify a built in MUI page before).

1) Maybe I am modifying the page too early, and it's being redone by the actual MUI_WELCOMEPAGE macro. I am inserting the PRE page right before MUI_WELCOMEPAGE though.

2) I am not getting the right "hwnd" or handle for the checkbox. I'm not sure how to figure out what the handle is. I know when I use InstallOptions, the correct item is "1200 + <label> -1." But I don't think that applies to built in MUI pages. So item #4 in the inSpecial.ini file.. hmm, well, 1203 does not seem to be doing the trick (the background of the checkbox is not white.

So for now, I have been unsuccessful. I am going to just insert another custom page right after the welcome page until I can figure this out :P Thanks for the help all.

-J
Jamyn is offline   Reply With Quote
Old 3rd October 2005, 02:17   #7
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
You could always use WinSpy (google it) to get the control's ID (near the bottom, in HEX, convert to DEC). Really useful little tool, that.
Animaether is offline   Reply With Quote
Old 4th October 2005, 06:13   #8
Jamyn
Junior Member
 
Join Date: Aug 2002
Location: Texas
Posts: 36
Thanks all, for the help. I now have it working as intended. I will do a writeup describing some of the mistakes I made, and the proper way to do this, and submit it to the Wiki or something similar.
Jamyn is offline   Reply With Quote
Old 4th October 2005, 09:54   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Quote:
Originally posted by Jamyn
I will do a writeup describing some of the mistakes I made, and the proper way to do this, and submit it to the Wiki or something similar.
Great, thanks!

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump