Old 28th July 2003, 14:35   #1
SGI
Junior Member
 
Join Date: Jul 2003
Location: USA
Posts: 34
Sections must be selected

I have an installer with sections all unselected(SECTION_OFF)
the customer must be select the section if he want to continue the installation.
Now if I dont select any section the I have the installation folder on my desktop with the readme and license installed because i have the following code(I WANT THIS)
Section "-General Readme/License"

SectionIn RO
SetOutPath "$INSTDIR"
File "${NSISDIR}\Examples\License.txt"
File "${NSISDIR}\Examples\Readme.txt

The others section are:
Function .onInit

SectionGetFlags ${sec1} $0
IntOp $0 $0 & ${SECTION_OFF}
SectionSetFlags ${sec1} $0
there is a total of 10 sections
Thank you in advance
SGI is offline   Reply With Quote
Old 28th July 2003, 14:47   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Sorry, what is your question?
Do you want it so that atleast 1 section has to be selected to install?

-Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2003, 14:58   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
If so, then you need to do this...
For Modern UI, you need to have a leave function of your components page
code:

!define MUI_CUSTOMFUNCTION_COMPONENTS_LEAVE "CheckComponents"

Function CheckComponents
## Check if atleast one component is selected
## ------------------------------------------
SectionGetFlags ${Sec1} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec2} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec3} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec4} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec5} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec6} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec7} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec8} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec9} $R0
StrCmp $R0 1 done
SectionGetFlags ${Sec10} $R0
StrCmp $R0 1 done

MessageBox MB_OK|MB_ICONEXCLAMATION "Please select a component to install!"
Abort ;goes back to page

done: ;if component was selected
FunctionEnd



If you aren't using Modern UI (you should!) then define the custom leave function like so:
Page Components "" "" "CheckComponents"

-Stu

Last edited by Afrow UK; 28th July 2003 at 16:55.
Afrow UK is offline   Reply With Quote
Old 28th July 2003, 16:48   #4
SGI
Junior Member
 
Join Date: Jul 2003
Location: USA
Posts: 34
Thank you ...yes I forgot to mention it "Im using MUI".
I wrote your code in the installer, it work very well.
Now m going to understaind
Thank you a lot.
SGI is offline   Reply With Quote
Old 28th July 2003, 16:58   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
No problem
Its very simple.

Sections are "1" if selected and "0" if not selected.
SectionGetFlags gets the section state.
"StrCmp $R0 1 done" will goto the end of the function (done label) because that shows that one of the components is selected.
If none are selected (all are state "0") then it will reach the error message box.

Btw, remove the "Push $R0" from the start, that isn't needed.

-Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2003, 17:49   #6
SGI
Junior Member
 
Join Date: Jul 2003
Location: USA
Posts: 34
Another question...
You wrote this command MB_ICONEXCLAMATION.
ITS possible to change the ICON????
Insert another icon.
SGI is offline   Reply With Quote
Old 28th July 2003, 18:14   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You cannot insert any icon unfortunately.
You can only have ICONS from Windows standard message boxes:

See section 4.9.4.14 of the NSIS user manual on the MessageBox command:

http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.4.14

-Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2003, 18:42   #8
SGI
Junior Member
 
Join Date: Jul 2003
Location: USA
Posts: 34
Ok thanks again ...I can use the stop icon or the icon in the script.
I think the Stop icon will be great.
Its coming more intresting .......
Probably Im bothering you but my installer have a long name about 50 letters (I have different collection for every years) and i want see the collection name during the installation.
May I change the lenght of the installer "MUI_CUSTOMFUNCTION_COMPONENTS_LEAVE"
SGI is offline   Reply With Quote
Old 28th July 2003, 19:34   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
So, you have a piece of text that is <50 characters long and you want it to be displayed in a MessageBox?
You can indeed add a MessageBox anywhere you like - in Functions and Sections.

You should have a look at all of the MUI Custom Functions available (read Contrib\Modern UI\Readme.html) - there's PRE SHOW and LEAVE functions for all Modern UI pages.
PRE is called before the page loads
SHOW is called when the page loads
LEAVE is of course called when the user clicks the next button

E.g.
!define MUI_CUSTOMFUNCTION_WELCOME_PRE WelcomeFunction
!define MUI_CUSTOMFUNCTION_INSTFILES_LEAVE InstFilesFunction

etc

It's probably better to display your string on an InstallOptions dialog (look in Contrib\InstallOptions and compile test.nsi script, also look at the Readme.html file.)

-Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2003, 20:31   #10
SGI
Junior Member
 
Join Date: Jul 2003
Location: USA
Posts: 34
Thanks so much ....im going to try tonight...ill let you know tomorrow.
SGI is offline   Reply With Quote
Old 29th July 2003, 13:40   #11
SGI
Junior Member
 
Join Date: Jul 2003
Location: USA
Posts: 34
Thank you Afrow UK its wworking ...great
SGI 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