Archive: [Page] Allow user to enter URL or choose default


[Page] Allow user to enter URL or choose default
Hello

How do I create a page allowing user to enter in the URL to download a .zip archive?

I want either a default URL where you can see the text (but user can edit) or a dropdown menu or radio buttons to choose between Default and Enter URL.

I will be using the InetC plugin.

How can I build this interface? (I will be using NSIS MUI)

Thanks in advance for any suggestions,

Chip D. Panarchy


You need to create a custom page with nsDialogs. The nsDialogs readme has an excellent tutorial: http://nsis.sourceforge.net/Docs/nsDialogs/Readme.html


Thanks, that method worked for the non-MUI interface, but I can't seem to get it working in MUI...

Can someone take a look?

Thanks,

Chip D. Panarchy




!include nsDialogs.nsh
!include LogicLib.nsh

!include "MUI2.nsh"

Name "BOOST Library Installer"
OutFile "Boost installer.exe"

InstallDir "$INSTDIR"
InstallDirRegKey HKCU "Software\Boost" ""

RequestExecutionLevel user
XPStyle on

!define MUI_ABORTWARNING

!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\GPL.txt"
!define MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE "Please enter boost download URL (zip)"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

#LangString PAGE_TITLE ${LANG_ENGLISH} "Title"
#LangString PAGE_SUBTITLE ${LANG_ENGLISH} "Subtitle"

#Function CustomPageFunction
#!insertmacro MUI_HEADER_TEXT $(PAGE_TITLE) $(PAGE_SUBTITLE)
#FunctionEnd

!insertmacro MUI_LANGUAGE "English"

Var Text
Var Text_State

Section "Dummy Section" SecDummy
SetOutPath "$INSTDIR"
#download $Text $TEMP
#unzip $TEMP\boost_1_46_1.zip
#run bjam.exe, set prefix to $INSTDIR

WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd

Page custom nsDialogsPage nsDialogsPageLeave

Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
SectionEnd

Function nsDialogsPage
StrCpy $Text_State "http://sourceforge.net/projects/boost/files/boost/1.46.1/boost_1_46_1.zip/download"

${NSD_CreateText} 0 13u 100% 12u $Text_State
Pop $Text

nsDialogs::Show
FunctionEnd

Function nsDialogsPageLeave
${NSD_GetText} $Text $Text_State
FunctionEnd

1. You need to put the custom page command inbetween the other page macros.
2. You don't create a custom page in your custom page function. Please follow the tutorial in the nsDialogs readme, as I pointed out before.