Old 24th April 2008, 09:31   #1
atlasimpression
Junior Member
 
Join Date: Apr 2008
Posts: 2
Unhappy next botton doesn't work on custom page

Hi all,

I try to create a custom page to verify the information user input. But when the install step going to the custom page, press the next> button can't lead me to next step.
Although the prev button still works.And also, the ValidateCustom function hasn't be executed. does anybody have any idea about that?

NSIS:2.56, 2.55

my refrence sample:
http://nsis.sourceforge.net/ADD_%22V...aller_by_ROHIT
http://nsis.sourceforge.net/wiki/Com...ons_user_input

my testing code:
code:

!define TEMP1 $R0 ;Temp variable
;Written by Rohit
;Include Modern UI
!include "MUI.nsh"
Name "serial Test"
OutFile "serial.exe"
InstallDir "$PROGRAMFILES\Modern UI Test"
!define MUI_ABORTWARNING
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "license.txt"
Page custom SetCustom ValidateCustom ": Testing InstallOptions" ;Custom page. InstallOptions gets called in SetCustom.
Page instfiles
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

;Things that need to be extracted on startup (keep these lines before ;any File command!)

;Use ReserveFile for your own InstallOptions INI files too!

ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "serial.ini"

;Order of pages
Page custom SetCustom ValidateCustom ": Testing InstallOptions" ;Custom page. InstallOptions gets called in SetCustom.

Page instfiles

Section "Components"


;Get Install Options dialog user input

ReadINIStr ${TEMP1} "$PLUGINSDIR\serial.ini" "Field 1" "State"
DetailPrint "Password X=${TEMP1}"


SectionEnd

Function .onInit

;Extract InstallOptions files
;$PLUGINSDIR will automatically be removed when the installer closes

InitPluginsDir
File /oname=$PLUGINSDIR\serial.ini "serial.ini"

FunctionEnd

Function SetCustom

;Display the InstallOptions dialog

Push ${TEMP1}

InstallOptions::dialog "$PLUGINSDIR\serial.ini"
Pop ${TEMP1}

Pop ${TEMP1}

FunctionEnd

Function ValidateCustom

FileOpen $1 $EXEDIR\${TEMP1}.ini w
FileClose $1

done:

FunctionEnd


;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

SetOutPath "$INSTDIR"

;ADD YOUR OWN FILES HERE...

;Store installation folder
WriteRegStr HKCU "Software\serial Test" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd


;--------------------------------
;Descriptions

;Language strings
LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."

;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;ADD YOUR OWN FILES HERE...

Delete "$INSTDIR\Uninstall.exe"

RMDir "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\serial Test"

SectionEnd



code:

[Settings]
NumFields=2
Title="Software Installation"

[Field 1]
Type=Password
Left=0
Right=-1
Top=60
Bottom=-67
MaxLen=25
MinLen=25

[Field 2]
Type=GroupBox
Left=0
Right=-1
Top=0
Bottom=-10
Text="Input Serial:"

atlasimpression is offline   Reply With Quote
Old 24th April 2008, 09:45   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You have MinLen and MaxLen settings in your INI file. Until those are satisfied, you won't be able to go to the next page. Specify ValidateText so a message box with the specified text will pop-up when those conditions aren't met.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 25th April 2008, 01:45   #3
atlasimpression
Junior Member
 
Join Date: Apr 2008
Posts: 2
So the problem is I haven't notice the limit of text length. @@ The next button works now. Thanks for your reply. ^^
atlasimpression is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump