Archive: Skipping MUI_PAGE_STARTMENU


Skipping MUI_PAGE_STARTMENU
Hello,
I am using MUI with a component to offer a choice for adding StartMenu items. So I want to display or not display the STARTMENU page depending on the setting.

The code below works fine when the component is selected. When deselected, the result seems OK and the STARTMENU page is skipped but the Next button never says Install. I assume this is because the compiler decided how many pages would be shown and set things up accordingly. So, is there a way to force it to say Install on the DIRECTORY page? Or beter yet, a way to skip the MUI_PAGE_STARTMENU macro?

This seems so ordinary that the code sequence must already be described; but alas I can't find it.

!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_PAGE_CUSTOMFUNCTION_PRE "startMenuIfNeeded"
!insertmacro MUI_PAGE_STARTMENU "Application" $ICONS_GROUP
!insertmacro MUI_PAGE_INSTFILES

Section "Shortcut Icons" INST_SCUT
SectionEnd

Function startMenuIfNeeded
Call check_shortcut_enable
Pop $PMtemp
Strcmp $PMtemp 1 ShowStart
Abort
ShowStart:
FunctionEnd

Function check_shortcut_enable
push $R0
SectionGetFlags ${INST_SCUT} $R0
IntOp $R0 $R0 & 1
Exch $R0
FunctionEnd
------------------


i usually do this:

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS

!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryShowPageCB
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_PAGE_CUSTOMFUNCTION_PRE StartMenuPrePageCB
!insertmacro MUI_PAGE_STARTMENU "SM" "$SMPage"
!insertmacro MUI_PAGE_INSTFILES

Section "Start Menu shortcuts" SECTIONIDX_StartMenu
#blah
SectionEnd

function DirectoryShowPageCB
!insertmacro SectionFlagIsSet "${SECTIONIDX_StartMenu}" ${SF_SELECTED} +5 ""
push $0
GetDlgItem $0 $HWNDPARENT 1
SendMessage $0 ${WM_SETTEXT} 0 "STR:$(^InstallBtn)"
pop $0
functionend

function StartMenuPrePageCB
!insertmacro SectionFlagIsSet "${SECTIONIDX_StartMenu}" ${SF_SELECTED} +2 ""
abort
functionend


Thanks Anders,
I'll give this a try.
Ummm... where is SectionFlagIsSet documented, and in particular what is ${SF_SELECTED} defined to?


See "NSIS\Include\Sections.nsh"


Got it. It works! Thanks bluenet and Anders.