Archive: Adding Required Option


Adding Required Option
Justin,
this was talked about inside a seperate thread.. And i thought i might throw this out in the open. Could/Would it be possible to add a feature to make certain sections required like to kinda follow Nsis's Scripting style.

Section /REQUIRED "SectionName"

SectionEnd

so you could define your own Required sections and have seperate ones to show ppl different things that are being installed and are required. And also having the possible to make the first selection not required. because i do a lot of install to simplify installing things.. and pretty much the user can choose what he/she wishes to install. right now i am working around this by just creating a bogus section with the name of the Installer with no code in it. so it don't matter if it is selected or not. And if you feel like not needing this then just disreguard it.. thanks..
Schultz


another feature along these lines which would be useful would be a callback when the user selects/deselects a particular section along with a command which would allow us to change a particular sections status. I'm thinking it would be used when one section depends on others then it could automatically select all dependancies. Or, display a message to the user the first time they select a particular section to let them know of any special instructions, requirements, license, etc....

thanks


I believe that this has a syntax already in place. I will have to look, but I believe that this is in place.

-Duane


Yes Yes.. Very Good
I definatly agree with these both (and I can't find anything in the docs that would allow you to do either of these currently..) Anyone know something I don't? Any plans for this (these) to be implemented in the future?

I really ,*really* love NSIS. It's a lifesaver over alot of the other options we have for installers. So devs, keep up the good work 8)


I believe you can accomplish most of this already (take a look at the docs):

* InstType (/NOCUSTOM | /CUSTOMSTRING=str | /COMPONENTSONLYONCUSTOM | install_type_name)
Adds an install type to the install type list, or disables the custom install type. There can be as many as 8 types, each one specifying the name of the install. The first type is the default (generally 'Typical'). Each type is numbered, starting at 1. See SectionIn for information on how those numbers are used. If the /NOCUSTOM switch is specified, then the "custom" install type is disabled, and the user has to choose one of the pre-defined install types. Alternatively, if the /CUSTOMSTRING switch is specified, the parameter will override the "Custom" install type text. Alternatively, if the /COMPONENTSONLYONCUSTOM flag is specified, the component list will only be shown if the "Custom" install type is selected.
* Section [section_name]
Begins annd opens a new section. If section_name is empty, omitted, or begins with a -, then it is a required section and the user will not see it, nor have the option of disabling it. If the section name is 'Uninstall', then it is a special Uninstall Section.
Rob

No No No..
then it is a required section and the user will not see it, nor have the That's not what I want.. Not only that but you can't do prerequists using either of the 2 things you mentioned..

And the callback when one compent is selected is definately not supported in any way, shape, or form.. More then anything I want to make a component required (or non-selectable) at runtime.


You can make a section required by using:

InstType /NOCUSTOM

Then just making the required section in each type.

However, I don't think its possible to set this at run time.

Rob


The thing is setting the no custom don't allow users to choose others things that may be optional to what they wish to install only what you have choosen for an install type. And adding the - prior to the name does this but dosn't allow the user to see the section something i don't wish for either.. i would like the user to know everything that is being installed on there cpu.. But just a few sections non selectable.


Here is sort of what I was looking for when I originally posted.
The program I am writting the install for has a couple of components, basically a client and a server. The client can be used in "localmode" where it uses sample data instead of connecting to the server. I have the install list the following pieces:


Now then, it makes no sense to install the sample data unless the Client piece is also selected. What I would like to do is, either disable the Sample Data when the Client is not selected, or to automatically select Client when the user selects Sample Data.

This could be solved by either the callback function, or if we could specify dependencies (one method would be a tree structure where Sample Data is below Client in the tree).

I have created different Install Types for Client, Server, Everything and such. But, I would have to create 11 install types for the simple example above. Add any more component in the mix and the number jumps very quickly.

Now then, I would imagine that doing the tree structure (which is basically how InstallShield deals with it) would probably add a lot of extra code to the engine. Since it's not going to apply to every install, I thought that the callback function would be the easiest method. I still think the dependencies would be nice so the user could visualize what is going on, but I'd settle for the simplistic.

Hrmm, does that explain it any better or am I just blabbering.

i aqree with the requests above, but i'd like to add something

what about an 'or' selection, one item can only be selected if the other one isn't selected and vice versa
or even better: the item is automatically deselected if the other one is selected by the user


Very easily accomplished if we have the callback function and the ability to query/set/unset sections from the script.

This could be a very powerful feature.


Query section would be very useful.

I need to make some steps in .onInstSuccess function based on user selections (e.g. if user selects to install documentation, installer prompts him to open it in the end). Now we have to use variables. But in my case all 10 variables are blocked for other purposes so I need to store user selections in temporary INI file which is not very nice. Ability to query section would be much better.


This post has been sitting for a while with no comment from Justin.. I would really like to hear what you think about this? Is it a possibilty or even an improbability? I would (honestly) write this if I had even a slight clue how, but I'm not that good of a C programmer (honestly I got last after trying to read about the first 10 lines of the NSIS source..) Anyway just want to know if this will ever get added or if we are just going to have to work around it..

I'll take another peak at the source and see if I can manage my way through it (having friends who program for a living comes in helpful at times.. 8)


I'm willing to write the code, but I hate to fork NSIS. I would much prefer that it is in the original distribution.


I don't like all the forks of NSIS either but here is my thought:
From the looks of the Changes lately it would appear that alot of the changes are from user submited code (or possibly even just psuedo-code). It may be that even though we want these option that Justin doesn't have the time to implement everying on his own. So what's wrong with helping him out? Write the code and then instead of doing you own builds, submit the code to Justin.

There was one thing I was just thinking that fell in line with alot of the ideas here. The ability (using the callback) to see what status a component is (enabled or disabled).

My suggestion to everyone who has made a fork that is just some small improvement (or single feature..) why not try to get the code included into the main NSIS fork. There are a lot of differant forks out there that have this 'one cool feature' that I want to use but I stick to the main compile because it's not worth that 1 feature when I know most fork developers lose interest and then I'm screwed.. Anyway..