Old 26th April 2005, 17:51   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Small bug perhaps?

I've noticed that since SubSection was replaced with SectionGroup, SectionGroupEnd now takes up a section index slot.

For example, if I have...
SectionGroup "Group"
Section "Section 1"
SectionEnd
SectionGroupEnd
...the last index (while looping through them before the error flag is set) should be 1 (Section 1's index). However, it's always 2...

If I put some more sections after the SectionGroup, their index's are 1 more than they should be.

Is this a bug or is it by design (for what reason?)

-Stu
Afrow UK is offline   Reply With Quote
Old 26th April 2005, 19:37   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
It always took a section index slot. The section group end is marked using a section with the SF_SECGRPEND flag which used to be called SF_SUBSECEND.

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 26th April 2005, 21:05   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That's interesting. I've never noticed it

Is there an easy way to check if a SectionGroup check-box is checked?

This problem (with the SectionGroupEnd taking up a slot) came up while I looped through all Sections in a SectionGroup to check if all were unselected, and I'd always find this odd one at the end which wasn't actually a Section (which broke the code).
I ended up putting a dummy section in to mark the end of the Sections group, but that isn't a very nice method.

Perhaps you could add a built-in SectionsCount define or something which refers to the highest section index.
It's not a huge problem, but it might come in useful (I'd find it useful!)

-Stu
Afrow UK is offline   Reply With Quote
Old 26th April 2005, 21:19   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You don't need to put a dummy section at the end, that weird section is the dummy section.

To check if a section group is selected or not, you can check the flags on the section group itself. If it's partially selected, the SF_PSELECTED flag will be turned on.

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 27th April 2005, 13:03   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Well that's the problem... whether or not the SectionGroup check-box is checked or not, I get $R0 as 0 when using:
SectionGetFlags ${PROG2} $R0
IntOp $R0 $R0 & ${SF_SELECTED}

-Stu
Afrow UK is offline   Reply With Quote
Old 28th April 2005, 17:04   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Attach an example script.

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 28th April 2005, 21:59   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Sorry, it works now.

-Stu
Afrow UK 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