Archive: MUI Component Must be Check. How?


MUI Component Must be Check. How?
What I want is To not let others Leave the Components Page
without Selecting atleast one.


My Problem Is I am using MUI and The Solutions I keep
Running accross is for Classic Installer or Non MUI.

I have the Function ready and all the Function Code works.
I tested it in Different Parts like Putting it in a Section. It
Didn't Call it till it was Starting to install but it worked .....
but I Can't get the Components Page to Call it. So how
would I go about it?

This Is What they Say to put it to Call the Function for
non MUI.

(componentsLeave Is the Fuction Name)


Page components "" "" componentsLeave


But MUI has it this way and Calling ComponentsLeave Isn't
working.


!insertmacro MUI_PAGE_COMPONENTS "" "" componentsLeave



I haven't Yet Found the Answer anywhere and I'm Sure it's
Simple to Figure out. Any help would be Great.

-MichaelFlya-

Use MUI_PAGE_CUSTOMFUNCTION_LEAVE. See the MUI readme for more information.


I read it for the last few weeks and nothing came about.
Would you be Willing to Verify what is what?



!insertmacro MUI_PAGE_CUSTOMFUNCTION_LEAVE function
!insertmacro MUI_PAGE_COMPONENTS "" "" componentsLeave


or


!insertmacro MUI_PAGE_CUSTOMFUNCTION_LEAVE function
!insertmacro MUI_PAGE_COMPONENTS componentsLeave


or


!insertmacro MUI_PAGE_CUSTOMFUNCTION_LEAVE componentsLeave
!insertmacro MUI_PAGE_COMPONENTS "" "" componentsLeave


or


!insertmacro MUI_PAGE_CUSTOMFUNCTION_LEAVE componentsLeave
!insertmacro MUI_PAGE_COMPONENTS componentsLeave


or Even


!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_CUSTOMFUNCTION_LEAVE componentsLeave


or Where does what Go?



Wait ...
Actually I now See that.


!insertmacro MUI_PAGE_CUSTOMFUNCTION_LEAVE componentsLeave


Should be

!define MUI_PAGE_CUSTOMFUNCTION_LEAVE componentsLeave


But I still Get nowhere.

-MichaelFlya-

Great Actually I Have now got it to work Using this. ;)



!define MUI_CUSTOMFUNCTION_GUIINIT componentsLeave
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE componentsLeave
!insertmacro MUI_PAGE_COMPONENTS





So Thanks Alot kichik !!!!!
:up: :up: :up: :up: :up: :up: :up: :up: :up: :up:

-MichaelFlya-

One more thing. Hopefully the Last for a bit...

I got it to work with my Uninstaller with this Code:


!define MUI_CUSTOMFUNCTION_UNGUIINIT Un.componentsLeave
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE Un.componentsLeave
!insertmacro MUI_UNPAGE_COMPONENTS



If I install all Three It works well if all three
Components are unchecked However...

I Have a IfFileExists Function Happening that makes the
Component only show up to Uninstall if one of the files
are there that would Have been installed. So if SECTION1
Doesn't Get Installed only SECTION4 and SECTION5 Show up to
Uninstall. So the Person only sees what they Installed.

The Problem is,

If You only installed two Components and run the Uninstaller,
it lets You Uncheck the two that Shows up and For some
Reason you can Run the Uninstaller and get by with not
Choosing one...


This is the Code I use to Keep Someone from Leaving the
Uninstaller Components page without Choosing one.



Function Un.componentsLeave

SectionGetFlags "${SECTION4}" $0
IntOp $1 $0 & ${SF_SELECTED}

SectionGetFlags "${SECTION5}" $0
IntOp $0 $0 & ${SF_SELECTED}
IntOp $1 $1 + $0

SectionGetFlags "${SECTION6}" $0
IntOp $0 $0 & ${SF_SELECTED}
IntOp $1 $1 + $0
StrCmp $1 "0" 0 +3

MessageBox MB_OK|MB_ICONSTOP "You must select at least one Section."
Abort
FunctionEnd



The Installer Section uses the Same Code... Just I use
SECTION1, SECTION2, and SECTION3 for the Installer Section
Names and it all works Perfect...

Here is the Sections so You can Better Understand me.

SECTION1<---Install File1
SECTION2<---Install File2
SECTION3<---Install File3

SECTION4<---UnInstall File1
SECTION5<---UnInstall File2
SECTION6<---UnInstall File3


Can you be of help one more time on the Uninstaller?

-MichaelFlya-

Seems fine... Attach the complete script.


kichik How do you Manage to Say one Sentence and still
Help me Figure this out ??????? :) Thanks !!!! :D


The Problem Was ....

Well I suppose it was the Order of the Functions, Because
after Rewriting it with the Same Code it has now Worked.

Plus Originally I was using Includes for most of the Script.
So I would have Default Settings for the Next thing I do.


I made this Script real neat and everything. If you like
it Can you please Have it Included in the Documentation of
the NSIS Installer in the Example Section. I have no idea
who Could Get it in there but if it had of been there I
wouldn't have been here... :)

The Script is Good for Teaching how to Use Components for
Installer and Uninstaller. Plus it Gives a good Start off for a
Quick Script Setup.

Thanks kichik And I'll be Back I'm Sure... I have Internet
Updater for an Installer to Research Next...

Thanks !!!

-MichaelFlya-

PS. Let me know if you or any others could have this Attached
Script Included in the Example Section of the NSIS for Everyone.


I Now See The Problem That Had been Causing all of this.

I use a Catagory Drop Down Bar.. Using this.


!ifndef NOINSTTYPES
InstType "Install All"
InstType "Un.UnInstall All"
!endif

And In Place Under Every Installer Section and Uninstaller
Section I Place this Code.

Sectionin 1


Which If all Three Components are Selected It
Gives a Message Install All or Uninstall All.

Other Wise Custom.

I didn't Use it for that Example Script I gave Above.

Place that in the Script and You will See. It lets you
For some reason do what I said It was doing. you can
Have two Components in the Uninstaller and uncheck
the two and it will allow you to Uninstall Nothing.

Or Even if one Component is Left it Still Will let you
Uninstall Nothing.

If you can Clear it up Thanks.. For now I will just not
Include That Part of the Script for the Uninstaller like
this.


!ifndef NOINSTTYPES
InstType "Install All"
!endif



-MichaelFlya-

You can post the example on the Wiki.

Adding InstType and SectionIn causes all of the sections to be in the same installation type. Since the user only sees the visible sections, those are the only sections that affect the installation type in the components page. However, the installation type also affects the invisible sections. That means, once the first and only installation type is selected, all of the sections with SectionIn 1 will also be selected, invisible or not. Since your componentsLeave function checks both visible and invisible sections, it allows the user to move on, if one invisible section is selected.

BTW, defining MUI_CUSTOMFUNCTION_GUIINIT is not needed for defining a leave function for the components page. It's a completely different callback function.