Archive: Small bug perhaps?


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


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.


That's interesting. I've never noticed it :o

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


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.


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


Attach an example script.


Sorry, it works now.

-Stu