- NSIS Discussion
- I would like to create a custom page
Archive: I would like to create a custom page
Speedy Gonzales
12th May 2006 18:55 UTC
I would like to create a custom page
Hi,
I have make a patchinstaller.
In this installer the user should choose one of 3 possibilitys.
When he choose e.g. the 1 in the drop list the files from the folder 1_High should be install. When he choose the 2 in the drop list the files from the folder 2_Middle should be install...
And further when the user chose e.g. 1 the picture 1.jpeg should be view.
I hope you understand what I mean.
Can you help me please and write me the code for this custompage?
Thank you
Sorry when my english isn't very good.
Speedy Gonzales
12th May 2006 21:05 UTC
Understand you my question ?
Please help me
Speedy Gonzales
13th May 2006 15:40 UTC
Could you only say me perhaps how I can make that when the user choose e.g. the 1 in the drop list the files from the folder 1_High would be install...?
The picture isn't so important.
Perhaps you can download my patch.rar there I've build the user page ... but without this function. Could you insert the code for this function in this patch.nsi?
Thank you
Speedy Gonzales
13th May 2006 23:14 UTC
Hi,
I have try now a lot of things and I hope that it could be work with the new code in my new Patch.rar.
..But there must be a problem. Can you say me what's wrong in the code?
Thank you
galil
14th May 2006 04:39 UTC
Do these 1_High, 2_Middle and 3_Low file folders must be in $INSTDIR? Or do you want them to be inside your Patch.exe? Or do you want them to be outside, in the $EXEDIR of Patch.exe?
Speedy Gonzales
14th May 2006 12:31 UTC
Hi,
the Folders will be install in the $INSTDIR
SetOutPath "$INSTDIR\1_High"
File "1_High\blood.spr"
SetOutPath "$INSTDIR\2_Middle"
File "2_Middle\blood.spr"
SetOutPath "$INSTDIR\3_Low"
File "3_Low\blood.spr"
Then the user can chose if he want the Files from the folder 1_high, 2_middle or 3_low. If he chose par example the 2_Middle the File blood.spr from the folder 2_Middle should be copy in the new patch folder. If he choose the 1_high the file blood.spr from the folde 1_high should be install.
I've try it to make this with the following code in my custompage.
..But it doesn't work. Can anybody say me what i've make wrong:
; Copy Netsettings
Function PatchPage
!insertmacro SectionFlagIsSet ${Section1} ${SF_SELECTED} ShowPage SkipPage
ShowPage:
GetDlgItem $R0 $HWNDPARENT 2
EnableWindow $R0 0|1 # 0=hide, 1=show
GetDlgItem $R0 $HWNDPARENT 3
ShowWindow $R0 ${SW_HIDE}
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "patch.ini"
SkipPage:
FunctionEnd
Function .OnGUIEnd
Call CopyFiles
FunctionEnd
; Copy Files
!macro COPY_FILES SOURCE
CopyFiles /silent "$INSTDIR\${SOURCE}\blood.spr" "$INSTDIR\patch"
goto done
!macroend
; Copy Netsettings
Function CopyFiles
Push $R0
ReadINIStr $R0 "$PLUGINSDIR\patch.ini" "Field 1" "State"
StrCmp $R0 "1_High" 0 not1_High
!insertmacro COPY_FILES 1_High
not1_High:
StrCmp $R0 "2_Middle" 0 not2_Middle
!insertmacro COPY_FILES 2_Middle
not2_Middle:
StrCmp $R0 "3_Low" 0 not3_Low
!insertmacro COPY_FILES 3_Low
not3_Low:
done:
Pop $R0
FunctionEnd
Function PageLeavePatch
ReadIniStr $0 '$PLUGINSDIR\patch.ini' 'Field 1' 'State'
strcmp $0 '' error ok
error:
MessageBox MB_OK "You haven't chose a Patch!"
abort
ok:
FunctionEnd
Thank you
galil
14th May 2006 22:35 UTC
Well, in the second patch.rar that you attached,
In the Section "Patch"
replace
SetOutPath "$INSTDIR\1_High"
File "1_High\blood.spr"
SetOutPath "$INSTDIR\2_Middle"
File "2_Middle\blood.spr"
SetOutPath "$INSTDIR\3_Low"
File "3_Low\blood.spr"
with:
Call CopyFiles
And fix all the String compares in the CopyFiles function.
Because you are comparing to "1_High", "2_Middle" etc, but in the patch.ini they are named just "High", "Middle" etc... so the copying can't get executed.
Speedy Gonzales
15th May 2006 18:28 UTC
Hi
THX it works :-).
Is it perhaps possible that when the user choose as example High in the droplist the picture 1.gif/.jpg .. whatever is shown and when he choose Middle in the droplist the picture 2.gif/.jpg.. is shown?
Thank you
galil
15th May 2006 19:41 UTC
Originally posted by Speedy Gonzales
Is it perhaps possible that when the user choose as example High in the droplist the picture 1.gif/.jpg .. whatever is shown and when he choose Middle in the droplist the picture 2.gif/.jpg.. is shown?
This thread has a working example of that:
http://forums.winamp.com/showthread....hreadid=244895
Although the image must be BMP, not JPG/GIF...
Speedy Gonzales
16th May 2006 13:07 UTC
Hi Galil thank you for your help
I've try no very long to insert the code for the picture in my .nsi but it doesn't work.
Could you perhaps help me an write me the code im my patch.nsi?
It would be very friendly from you.
This is my final patch. In the droplist are three possibilitys
Low
Middle
Extrem
It should be that the picture 1.bmp will be shown (the preview should be under the droplist) when the user choose low
The picture 2.bmp when he choose middle in the droplist..
Thank you