WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Section control using flags
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
cosmic66
Junior Member

Registered: Jan 2003
From:

Section control using flags

Hi!

I'm new to NSIS and try to achieve the following:
I have two sections (s0 and s1) and their state (selection ON|OFF) should be dependend on each other:

When section s0 is deselcted, section s1 should be deselcted.
When section s1 is selected, section s0 should be deselcted.

I have followed the procedure described in previous postings and in
example "one-selection".

I have attached my NSI-file to this posting,
Setting the flags doesn't have an effect and s1 is not interactive in
the installer after its flag has been written.

I'm using NSIS v2.0b0.

Thanks for any hints on how to solve this problem!

Attachment: test.nsi
This has been downloaded 403 time(s).

Quick Link | Report this post to a moderator | IP: Logged

cosmic66 is offline Old Post 01-16-2003 12:02 PM
Click Here to See the Profile for cosmic66 Click here to Send cosmic66 a Private Message Find more posts by cosmic66 Add cosmic66 to your buddy list Edit/Delete Message Reply w/Quote
cosmic66
Junior Member

Registered: Jan 2003
From:

Re: Section control using flags

quote:
Originally posted by cosmic66
[...]
When section s0 is deselcted, section s1 should be deselcted.
When section s1 is selected, section s0 should be deselcted.
[...]
[/B]


Sorry, there was a mistake,
the correction is:


When section s0 is deselcted, section s1 should be deselcted.
When section s1 is selected, section s0 should be selected.

Quick Link | Report this post to a moderator | IP: Logged

cosmic66 is offline Old Post 01-16-2003 12:09 PM
Click Here to See the Profile for cosmic66 Click here to Send cosmic66 a Private Message Find more posts by cosmic66 Add cosmic66 to your buddy list Edit/Delete Message Reply w/Quote
virtlink
Major Dude

Registered: Sep 2002
From: At [4C69:6E6B]

That's where the Edit button is for .

__________________

"I'll quote you when you say something memorable."
- Claudia Pelsmaeker

Quick Link | Report this post to a moderator | IP: Logged

virtlink is offline Old Post 01-16-2003 07:13 PM
Click Here to See the Profile for virtlink Click here to Send virtlink a Private Message Find more posts by virtlink Add virtlink to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Israel

Have you tried settings the initial value for $R0 and $R1? Set it in .onInit.

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 01-17-2003 11:26 AM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
cosmic66
Junior Member

Registered: Jan 2003
From:

Thumbs up

quote:
Originally posted by kichik
Have you tried settings the initial value for $R0 and $R1? Set it in .onInit.


Thanks for your quick answer.
Setting the initial value for $R0 and $R1 doesn't make a difference.


But still I was able to solve the problem
I had a mistake in my flow (in which case to jump to which label) and I was using the wrong operation when setting the flag to being deselcted.

In case someone is interested, the working skript is attached to this posting.

Attachment: test.nsi
This has been downloaded 396 time(s).

Quick Link | Report this post to a moderator | IP: Logged

cosmic66 is offline Old Post 01-17-2003 12:04 PM
Click Here to See the Profile for cosmic66 Click here to Send cosmic66 a Private Message Find more posts by cosmic66 Add cosmic66 to your buddy list Edit/Delete Message Reply w/Quote
japheth
Junior Member

Registered: Mar 2002
From: Canada

I'm looking to do something similar, but not quite.

Here's what I need to do:

There are 4 components.

I need components 1 and 3 to be co-dependent upon one another. So, if a user selects component 1 and component 3 is selected, component 3 becomes unselected. Similarly, if a user selects component 3 and component 1 is selected, component 3 becomes unselected.

I've looked at one-section.nsi and at the script posted on this thread, and I sort of get it, however, it's not the kind of programming logic I'm used to coding in.

Any help is appreciated.

Quick Link | Report this post to a moderator | IP: Logged

japheth is offline Old Post 01-17-2003 08:11 PM
Click Here to See the Profile for japheth Click here to Send japheth a Private Message Click Here to Email japheth Find more posts by japheth Add japheth to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Israel

I don't understand, if you got it to work what's the problem?

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 01-18-2003 11:17 AM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
japheth
Junior Member

Registered: Mar 2002
From: Canada

Sorry, I guess I should of explained myself better.

I don't have it working at all. And actually, instead of co-dependent, I should of said mutually exclusive.

one-section.nsi is *almost* what I need. The only thing is, in one-section.nsi, at least one section is required. I need something similar to that, except that no section will be required, the user just can't have component 3 selected if component 1 is selected and visa-versa.


Hopefully that clears things up.

Quick Link | Report this post to a moderator | IP: Logged

japheth is offline Old Post 01-18-2003 05:13 PM
Click Here to See the Profile for japheth Click here to Send japheth a Private Message Click Here to Email japheth Find more posts by japheth Add japheth to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Israel

OK, then lets think of a script logic for that.

What you need to do is initially select only one of them to make the initial state valid. Do this in .onInit. Remember what section you initially selected. Then in .onSelChange check to see if the section that wasn't remembered is selected. If it is, remember it and uncheck the one that was remembered earlier. That's all you need to do. It should cover all cases.

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 01-18-2003 07:15 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
virtlink
Major Dude

Registered: Sep 2002
From: At [4C69:6E6B]

I think he has come up with that idea too, but didn't find the right words for it. What code should he use?

__________________

"I'll quote you when you say something memorable."
- Claudia Pelsmaeker

Quick Link | Report this post to a moderator | IP: Logged

virtlink is offline Old Post 01-18-2003 09:18 PM
Click Here to See the Profile for virtlink Click here to Send virtlink a Private Message Find more posts by virtlink Add virtlink to your buddy list Edit/Delete Message Reply w/Quote
japheth
Junior Member

Registered: Mar 2002
From: Canada

Yeah, virtlink hit the proverbial nail on the head.

I know the logic that's required, it's just that I'm pretty bad with NSIS's programming logic.

I hate being hand-held just as much as the next person, but I've been farting around with this for the past couple of days with no results.

If someone could come up with a small snippet of code, I'd be much appreciative.

Perhaps it could even be included in the examples as mutual-excluseive.nsi or something. I'm sure someone else will want to do something similar to this in the future.

Quick Link | Report this post to a moderator | IP: Logged

japheth is offline Old Post 01-19-2003 07:29 AM
Click Here to See the Profile for japheth Click here to Send japheth a Private Message Click Here to Email japheth Find more posts by japheth Add japheth to your buddy list Edit/Delete Message Reply w/Quote
kichik
M.I.A.
[NSIS Dev, Mod]

Registered: Oct 2001
From: Israel

Enjoy:

http://nsis.sourceforge.net/archive...;instances=0,64

__________________
NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius

Quick Link | Report this post to a moderator | IP: Logged

kichik is offline Old Post 01-19-2003 03:52 PM
Click Here to See the Profile for kichik Click here to Send kichik a Private Message Visit kichik's homepage! Find more posts by kichik Add kichik to your buddy list Edit/Delete Message Reply w/Quote
japheth
Junior Member

Registered: Mar 2002
From: Canada

Thanks a lot kichik.

Quick Link | Report this post to a moderator | IP: Logged

japheth is offline Old Post 01-20-2003 12:02 AM
Click Here to See the Profile for japheth Click here to Send japheth a Private Message Click Here to Email japheth Find more posts by japheth Add japheth to your buddy list Edit/Delete Message Reply w/Quote
tkm2007
Junior Member

Registered: Oct 2007
From:

Hello everyone!

I am trying to create an installer with 2 sections which cannot be both selected at once, exactly as japheth. I saw the example kichik posted, but I would like to ask how I can have the second section selected by default, and not the first one as shown in the example.

Thank you!

Quick Link | Report this post to a moderator | IP: Logged

tkm2007 is offline Old Post 10-25-2007 09:00 AM
Click Here to See the Profile for tkm2007 Click here to Send tkm2007 a Private Message Find more posts by tkm2007 Add tkm2007 to your buddy list Edit/Delete Message Reply w/Quote
pospec
Senior Member

Registered: Jun 2007
From: Otrokovice, Czech Republic

I didn't see kichik's example but I'll give you my. I hope it is what you need.

PHP:

name
'example'

outfile 'example.exe'

!include 'sections.nsh'

page components
page instfiles

showinstdetails show

var sec_var

section
/o 'first' sec_1
  detailprint
'first section'
sectionend

section
'second' sec_2
  detailprint
'second section'
sectionend

function .onselchange
  
!insertmacro startradiobuttons $sec_var
    
!insertmacro radiobutton ${sec_1}
    !
insertmacro radiobutton ${sec_2}
  !
insertmacro endradiobuttons
functionend

__________________
My new location

Quick Link | Report this post to a moderator | IP: Logged

pospec is offline Old Post 10-25-2007 09:13 AM
Click Here to See the Profile for pospec Click here to Send pospec a Private Message Visit pospec's homepage! Find more posts by pospec Add pospec to your buddy list Edit/Delete Message Reply w/Quote
tkm2007
Junior Member

Registered: Oct 2007
From:

Thank you pospec for your quick reply. I have already found this way in the web, but it doesn't give me the option to have no section selected as kichik's example does. Thank you anyway!

Quick Link | Report this post to a moderator | IP: Logged

tkm2007 is offline Old Post 10-25-2007 09:17 AM
Click Here to See the Profile for tkm2007 Click here to Send tkm2007 a Private Message Find more posts by tkm2007 Add tkm2007 to your buddy list Edit/Delete Message Reply w/Quote
pospec
Senior Member

Registered: Jun 2007
From: Otrokovice, Czech Republic

I see. If you like his example then you can modify it for your purposes. Just change IntOp $0 $0 & ${SECTION_OFF} with IntOp $0 $0 | ${SF_SELECTED} and vice versa in .onInit

__________________
My new location

Quick Link | Report this post to a moderator | IP: Logged

pospec is offline Old Post 10-25-2007 09:24 AM
Click Here to See the Profile for pospec Click here to Send pospec a Private Message Visit pospec's homepage! Find more posts by pospec Add pospec to your buddy list Edit/Delete Message Reply w/Quote
pospec
Senior Member

Registered: Jun 2007
From: Otrokovice, Czech Republic

I missed one thing - remember ${sec2} in $R9 on init.

__________________
My new location

Quick Link | Report this post to a moderator | IP: Logged

pospec is offline Old Post 10-25-2007 09:31 AM
Click Here to See the Profile for pospec Click here to Send pospec a Private Message Visit pospec's homepage! Find more posts by pospec Add pospec to your buddy list Edit/Delete Message Reply w/Quote
tkm2007
Junior Member

Registered: Oct 2007
From:

quote:
Originally posted by pospec
I see. If you like his example then you can modify it for your purposes. Just change IntOp $0 $0 & ${SECTION_OFF} with IntOp $0 $0 | ${SF_SELECTED} and vice versa in .onInit


Thank you very much pospec for your time! It workd!

Quick Link | Report this post to a moderator | IP: Logged

tkm2007 is offline Old Post 10-25-2007 09:32 AM
Click Here to See the Profile for tkm2007 Click here to Send tkm2007 a Private Message Find more posts by tkm2007 Add tkm2007 to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 08:59 PM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Section control using flags
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON