Archive: Section/Component Screen,Strange Indexed Display Problem


Section/Component Screen,Strange Indexed Display Problem - Pretty Pictures included!
Including a .jpg of the issue at hand. The comonents screen is inserting a line at the top of the section list equating to the count of the number of sections I have minus one. ) That line [10]- doesn't exist in my code....
http://www.jericho-media.com/images/...dexProblem.jpg

If I comment out every reference in the code to section g1oB, then this view is shown: ( Note the decrement of the errant row... )

http://www.jericho-media.com/images/...exProblem2.jpg


If you look closely, you'll find that the top section is (incorrectly displayed as an index), ( currently equaling the number of sections I'm defining less one. ( zero indexed - I presume ) Has anyone had this happen to them before?

Source of issue: My strange requirements make me want to use the components screen twice. Recording differenct selections and handling them seperately later. Ultimately, there will be zero relevant code in the actual sections, but neverthe less, I want to use the component page interface twice..... thus..... I do the following:


ComponentText "Blah blah" "Again Blah" " "
Page components setupComponents "" components_leave

ComponentText "Blah de balh balh" "MoreBlah" " "
Page components setupComponents2 "" components_leave2

Please note that the two setupComponents functions differ slightly as to the display... if I REMOVE all mention of the second call to the components page, ( and only use the components screen once....) the system behaves normally.... but if I reference it twice this strange index issue happens... ( And on the first call to the page, not the second. ) ... and then I get odd indexing behavior, and the second page doesn't display properly either.

Furthermore if I set it up to call the setupComponents functions as the show functions instead of the pre functions then it displays like this:
http://www.jericho-media.com/images/...exProblem3.jpg


I have a series of sections which I am turning on and off in my pre-display call like so:



;The only thing I do in my function call other than change the text names of hte sections to empty strings.. is to disable the NEXT button until a callback is made to the .onSelChange

Function setupComponents

Var /GLOBAL NextButton
; Disable the next button until selection is made.
GetDlgItem $NextButton $HWNDPARENT 1
EnableWindow $NextButton "0"

RunPlatforms:
SectionSetText ${g1o1} "" ; These we dont' show...
SectionSetText ${g1o2} ""
SectionSetText ${g1o3} ""
SectionSetText ${g1o4} ""
SectionSetText ${g1o5} ""
SectionSetText ${g1o6} ""
; Hide the platform options.
SectionSetText UnselectSection ${g1o7} ; these
SectionSetText UnselectSection ${g1o8} ; we
SectionSetText UnselectSection ${g1o9} ; do.
SectionSetText UnselectSection ${g1oA}
SectionSetText UnselectSection ${g1oB}
FunctionEnd


// The sections are defined as so:


Section /o "New Install" g1o1
SectionEnd

Section /o "Install Fresh (Discard local configuration.)" g1o2
SectionEnd

Section /o "Upgrade (Retain existing settings.)" g1o3
SectionEnd

Section /o "Archive Utility" g1o4
SectionEnd

Section /o "Restore Utility" g1o5
SectionEnd

Section /o "Uninstaller" g1o6
SectionEnd

Section /o "Imail Declude Install" g1o7
SectionEnd

Section /o "SmarterMail Declude Install" g1o8
SectionEnd

Section /o "Alligate Declude Install" g1o9
SectionEnd

Section /o "Imail MXGuard Install" g1oA
SectionEnd

Section /o "Default SNF Install" g1oB
SectionEnd


I have solved the issue:


Ok, so for the record: Because this question was asked many times previously, but not in a way people understood it.... and the manual was descriptively silent on how to include multiple Component Pages ( or any other pages for that matter. )

In order to call a standard ( not custom page ) multiple times, it seems you need to encapsulate it in a PageEx call. For example: In order to have two fixed component type pages.... you need to put this in your page order:

PageEx components
ComponentText "Welcome. Please select from the available utilities." " " " "
PageCallbacks setupPlatforms showPlatforms components_leave2
PageExEnd

PageEx components
ComponentText "Welcome Please select from the available utilities." " " " "
PageCallbacks setupComponents2 "" components_leave2
PageExEnd


Don't forget that as you use SectionSetText SectionName "" to hide sections from each components page... i.e.
On the first component page.... you hide the sections you ask about in section 2. And then on Section two you hide the page 1 components.... if you go back.. from page 2 to page 1 nothing will show because you've cleared them all.... so unless you create a resetSectionTexts function and call it from/in your Pre functions.... and then reclear the ones you don't want to show up.... you scratch your head for a week, going huh?
i.e.

Function resetSectionTexts
SectionSetText SectionName "OriginalTextHere"
.... as many as you have sections...
FunctionEnd


Keywords:
Multiple Component Pages
Calling Section Page Twice
Component Page Twice
Two Component Pages
Two Section Pages
Use of PageEx
Calling a Page Twice


Gee....Thats such a perfectly written issue and solution completely documented. I'd like to thank you for coming back and including a detailed solution to the problem and properly keywording it for future NSIS head-scratchers.


Why, thank me. Me is to kind.
lol.
;-)