Archive: MUI_PAGE_COMPONENTS - hide SectionGroup


MUI_PAGE_COMPONENTS - hide SectionGroup
  Hi,

I have read all the tips here in the forum concerning my problem, but couldn't solve it yet.

I have 2 SectionGroups. The first one should be completely hidden depending on some values checked/ defined in the .onInit function.

But no matter what I try I did not get the SectionGroup hidden - it is always shown (the Sections inside are hidden as they should).

I have read (and understood) about clearing the hidden SF_SECGRPEND flag.

Do I overlook something?

SectionGroup/e "Reset Config Section Group" SecGrpResetConfig 

Section"Delete Config File Section" SecDeleteConfigFile

SectionEnd

;Delete chart DB (CHRTLIST.DAT)
Section "Delete ChartDB Section" SecDeleteChartDB

SectionEnd

;Delete SENC directory
Section"Delete SENC Section" SecDeleteSENC

SectionEnd
SectionGroupEnd

>;Shortcut Section
SectionGroup/e "Shortcuts Section Group" SecGrpShortcuts
Section"Startmenu Shortcut Section" SecShortcutStartmenu
;Start Menu
SectionEnd

Section"Desktop Shortcut Section" SecShortcutDesktop
;Desktop
SectionEnd
SectionGroupEnd

>Function .onInit
${If} $CONFIG_EXISTS != 1
${OrIf} $CONFIG_EMPTY == 1
!insertmacro ClearSectionFlag ${SecDeleteConfigFile} ${SF_SELECTED}
SectionSetText ${SecDeleteConfigFile} ""
!insertmacro ClearSectionFlag ${SecDeleteChartDB} ${SF_SELECTED}
SectionSetText ${SecDeleteChartDB} ""
!insertmacro ClearSectionFlag ${SecDeleteSENC} ${SF_SELECTED}
SectionSetText ${SecDeleteSENC} ""
!insertmacro ClearSectionFlag ${SecGrpResetConfig} ${SF_SECGRP}
!
insertmacro ClearSectionFlag ${SecGrpResetConfig} ${SF_SELECTED}
SectionSetFlags ${SecGrpResetConfig} 0
SectionSetText${SecGrpResetConfig} ""
IntOp $0 ${SecDeleteSENC} + 1
!insertmacro ClearSectionFlag $0 ${SF_SECGRPEND}
SectionSetText $0 ""
;MessageBox MB_OK|MB_ICONEXCLAMATION "Macro S0: $0" ;#DEBUG
${EndIf}
>FunctionEnd
>
I am using version 2.46 - Unicode with the ModernUI2 and therefor MUI_PAGE_COMPONENTS.

Any help is very much appreciated! :)

Thanks,
Gunther

Have you tried to rename them to ""? That will hide a normal section.


Originally posted by MSG
Have you tried to rename them to ""? That will hide a normal section.
You mean the line

SectionSetText ${SecGrpResetConfig} "" 

in the .onInit function?
If so, the answer is yes.

As I am using a multilanguage version I have also tried to use an empty LangString for each language:
SectionSetText${SecGrpResetConfig} $(EmptyString) 

No change in result - the SectionGroup still shows up on the Components page (with the string of the choosen language), which leads me to the assumption that somethings goes wrong with emptying the SectionText. But I have no idea where or why, yet.

Gunther

Addition 1:
Tried the exact same code for my second SectionGroup (which never has to be hidden) and guess what? It disappears without any problem.

So there might be a bug that a SectionGroup does not disappear if it is the first one in the row of Sections(Groups)?

I'll do some further tests to figure out the differences between my two SectionGroups and hopefully find the reason why one disappears correctly and the other do not.

So if anyone has an idea or had have the same problem, tips and possible solutions/ workarounds are still very much appreciated.

Thanks!

Originally posted by Netsurfer24
You mean the line
SectionSetText${SecGrpResetConfig} "" 

in the .onInit function?
If so, the answer is yes.
Oops, my bad.

If you add a hidden, empty section on top, does it still refuse to hide the group?

How about just reversing the order of the two groups?

Problem solved
  Hi,

Originally posted by MSG
Oops, my bad.

If you add a hidden, empty section on top, does it still refuse to hide the group?

How about just reversing the order of the two groups?
no, not your fault - my fault.

I have overlooked a line at the end of my .onInit function which sets the text for the SectionGroup. :rolleyes:

So after hiding the Group the name was set again to something else than an empty string.

Now everything works as expected! :up:

No bug or any other 'weird' circumstances - just a dumb coder ...!

For the archive: The code in the first posting is correct.

@MSG: Thanks for your help.
Sorry for the unnecessary question.

Thanks,
Gunther

How to dynamically display a hidden SectionGroup
  Hi,

it's me again ...! Now that I have managed to dynamically hide sections and sectiongroups I have some difficulties to show it up again.

I want to change its state (shown|hidden) in the .onSelChange function.

What has to be done to show it again?

  1. SectionSetText ... for all Sections and the SectionGroup
  2. SectionSetFlags ... ???
Anything else?

And how about the Section Flags which I have cleared when hiding the Section Group?
Which ones do I have to set again?

Does the order play a role?

Thanks,
Gunther

Update 1:
I am one step further - my code seems to be OK. The problem is that the components page (or just the components list) needs to be refreshed/ updated. If I use the back button and return to the page my sectiongroup is hidden or shown correctly.
Anyone who can tell me how to refresh/ update the page or list?