View Single Post
Old 30th March 2015, 21:58   #6
Junior Member
Join Date: Feb 2015
Posts: 25
Originally Posted by Anders View Post
Showing 60 pages in a installer is insane!

There are several ways to show the same page several times, they all suck:

I would recommend that you just have 2 custom pages. Page 1 would contain a list of profiles and page 2 would edit the selected profile. You would then skip the 2nd page if no profile is selected or jump back to page 1 after editing a profile...
trying to follow option 2 for a pattern. The code you gave is repeating the dialog. My code is showing the dialog one time. I am missing something. Below is my code.

!include MUI2.nsh
!include "nsDialogs.nsh"
!include "LogicLib.nsh"
!include "FtpProfile.nsdinc"

Var max_Profiles ; Maximum number of profiles
Var ndx_num ; index of where we are in the Profile Loop

Var ProfileName
Var LclPSDir
Var RmtPSDir
Var LclConDir

Page components
Page custom fnc_FtpProfile_PreShow fnc_FtpProfile_AfterShow

Section /o "Config Profiles" Profiles ;FTPCFGXX.CMD {Steps 16-19, 23}
SectionIn 1 7
;StrCpy $max_Profiles 15

!macro _ShowAnotherFTPPage _a _b _t _f
IntOp $ndx_num $ndx_num + 1
IntCmp $ndx_num $max_Profiles `${_f}` `${_t}` `${_f}`
!define ShowAnotherFTPPage `"" ShowAnotherFTPPage ""`

!macro InitFTPPageLoop
StrCpy $ndx_num 0
StrCpy $max_Profiles 15

Function fnc_FtpProfile_PreShow
SectionGetFlags ${Profiles} $R0
IntOp $R0 $R0 & ${SF_SELECTED}
IntCmp $R0 ${SF_SELECTED} show


GetDlgItem $0 $hwndparent 1
${NSD_SetText} $0 "$(^NextBtn)"
;!insertmacro InitFTPPageLoop

Call fnc_FtpProfile_Create2
Call LoadFTPProfileData
StrCpy $0 0
Call fnc_FtpProfile_Show

${If} $0 <> 0
${AndIf} ${ShowAnotherFTPPage}
MessageBox MB_OK "Showing Dialog again"
GetDlgItem $0 $hwndparent 3
EnableWindow $0 0 ; Disable back button
Goto reloadFTPProfile


Function LoadFTPProfileData

ReadINIStr $ProfileName "$Temp\DosB\FTP" "Profiles" "ProfileName$ndx_num"
ReadINIStr $LclPSDir "$Temp\DosB\FTP" "Profiles" "LclPSDir$ndx_num"
ReadINIStr $RmtPSDir "$Temp\DosB\FTP" "Profiles" "RmtPSDir$ndx_num"
WriteINIStr $LclConDir "$Temp\DosB\FTP" "Profiles" "LclConDir$ndx_num"

${NSD_SetText} $hCtl_FtpProfile_TB_ProfName $ProfileName
${NSD_SetText} $hCtl_FtpProfile_TB_LCLPSDir $LclPSDir
${NSD_SetText} $hCtl_FtpProfile_TB_RmtPSDir $RmtPSDir
${NSD_SetText} $hCtl_FtpProfile_TB_LclConDir $LclConDir

Function fnc_FtpProfile_AfterShow
${NSD_GetText} $hCtl_FtpProfile_TB_ProfName $ProfileName
${NSD_GetText} $hCtl_FtpProfile_TB_LCLPSDir $LclPSDir
${NSD_GetText} $hCtl_FtpProfile_TB_RmtPSDir $RmtPSDir
${NSD_GetText} $hCtl_FtpProfile_TB_LclConDir $LclConDir

WriteINIStr "$Temp\DosB\FTP" "Profiles" "ProfileName$ndx_num" $ProfileName
WriteINIStr "$Temp\DosB\FTP" "Profiles" "LclPSDir$ndx_num" $LclPSDir
WriteINIStr "$Temp\DosB\FTP" "Profiles" "RmtPSDir$ndx_num" $RmtPSDir
WriteINIStr "$Temp\DosB\FTP" "Profiles" "LclConDir$ndx_num" $LclConDir
coderwolf is offline   Reply With Quote