- NSIS Discussion
- labels on the finish page
Archive: labels on the finish page
bubu
25th February 2008 11:58 UTC
labels on the finish page
i am trying to put labels on my finish page depending on what is installed during my process. so far i could make message boxes to show what was installed. but those appear only at the end after i press the finish button. they were veeery useful but it was for testing only.
this is my code for one program..the rest are almost the same:
Function OnLeaveFinish
;jre part
;Call InstallJRE
StrCpy $CorrectJRE $0
StrCmp $InstallJRE "no" 0
${If} $InstallJRE == "no"
MessageBox MB_OK "JRE e instalat"
${Else}
MessageBox MB_OK "JRE s-a instalat ACUM"
${EndIf}
;other programs
FunctionEnd
this is what i have put in my function.
so...my big problem now is that i cannot do the same but with labels. on the finish page.
this is how i called the function at the begining:
;------------------------------
; Finish Page
;------------------------------
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION "OnLeaveFinish"
!define MUI_FINISHPAGE_TEXT "The following programs were installed on your computer:"
do you have any idea how to do this? how to put labels on the directly on the finish page...it has to look the same..but instead of message boxes ,,there has to be labels.
thank you!
Afrow UK
25th February 2008 13:25 UTC
Why not use a ListBox control? You need to modify ioSpecial.ini at run time before the finish page is displayed. Search the forum for ioSpecial.ini
Stu
bubu
26th February 2008 06:45 UTC
why?
why do i have to use a listbox? i was thinking that if i could do the if-else thing with message boxes it should be pretty much the same with labels...but it does not work yet..:(
Afrow UK
26th February 2008 13:10 UTC
Yeh fine you can use a label control, but you have limited space and an item per line may not fit. Either way it doesn't really matter what control you use; the principle is the same. Concatenate your text to a global variable using StrCpy:
StrCpy $MyVar `new text$\r$\n$MyVar`
Then you can display this text on the finish page by writing it to ioSpecial.ini before showing the finish page (PRE function). Like I said, search for ioSpecial.ini and you will find plenty of examples for adding your own controls to the finish page (assuming you can find room to fit it in).
Stu
bubu
26th February 2008 18:20 UTC
yep
i have solved the problem...i used iospecial.ini. i made a function to create those labels. thx:)
bubu
26th February 2008 18:58 UTC
now it's true that xp has a problem with setting the background ? i found loads of topics with text and backgrounds etc... but nothing can change my grey background... it's silly
this is what i have written in my function to set the colors:
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 6" "HWND"
SetCtlColors $0 0x000000 transparent
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 7" "HWND"
SetCtlColors $0 0x000000 transparent
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 8" "HWND"
SetCtlColors $0 0x000000 transparent
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 8" "HWND"
SetCtlColors $0 0x000000 transparent
InstallOptions::show
bubu
27th February 2008 00:26 UTC
almost there
this is what i declared first:
!define MUI_PAGE_CUSTOMFUNCTION_PRE CreateControls
!define MUI_PAGE_CUSTOMFUNCTION_SHOW SetControlColours
!define MUI_INSTALLCOLORS "0xFFFFFF 0x000000"
then..the functions:
Function CreateControls
;pcvisit label
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Settings" "NumFields" "8"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 8" "Type" "Label"
IfFileExists "$PROGRAMFILES\PCVisit\PC_Visit.exe" 0
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 8" "Text" "$(DESC_Section5)"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 8" "Left" "120"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 8" "Right" "270"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 8" "Top" "142"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 8" "Bottom" "154"
WriteINIStr "$PLUGINSDIR\iospecial.ini" "Field 8" "State" "3"
FunctionEnd
Function SetControlColours
InstallOptions::InitDialog /NOUNLOAD "iospecial.ini"
ReadINIStr $0 "$PLUGINSDIR\iospecial.ini" "Field 8" "HWND"
SetCtlColors $0 0x000000 transparent
; Reload window
GetDlgItem $0 $HWNDPARENT 1
ShowWindow $0 ${SW_HIDE}
ShowWindow $0 ${SW_SHOW}
; Now show the dialog and wait for it to finish
InstallOptions::show
FunctionEnd
but i STILL have the gray background where the labels are... like in the attached photo above. :-<
demiller9
27th February 2008 01:33 UTC
You are getting the handle of the Next (Finish) button with "GetDlgItem 1". Try using the id of the static control where the text is written: 1202.
bubu
27th February 2008 07:28 UTC
i could only wish
well..didn't worked.:( and by the way with that "field 8" i have field6, field 7, field 9.
...and i am so sure this is a very simple thing...annoying
my code:
Function SetControlColours
ReadINIStr "$0" "$PLUGINSDIR\ioSpecial.ini" "Field 6" "HWND"
GetDlgItem $0 $HWNDPARENT 1205
;SetCtlColors "$0" "000000" Transparent
ReadINIStr "$0" "$PLUGINSDIR\ioSpecial.ini" "Field 7" "HWND"
GetDlgItem $0 $HWNDPARENT 1206
;SetCtlColors "$0" "000000" Transparent
ReadINIStr "$0" "$PLUGINSDIR\ioSpecial.ini" "Field 8" "HWND"
GetDlgItem $0 $HWNDPARENT 1207
;SetCtlColors "$0" "000000" Transparent
ReadINIStr "$0" "$PLUGINSDIR\ioSpecial.ini" "Field 9" "HWND"
GetDlgItem $0 $HWNDPARENT 1208
;SetCtlColors "$0" "000000" Transparent
; Reload window
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioSpecial.ini"
Pop $0 ;HWND
GetDlgItem $0 $HWNDPARENT 1
SetCtlColors $0 "FFFFFF" Transparent
ShowWindow $0 ${SW_HIDE}
ShowWindow $0 ${SW_SHOW}
FunctionEnd
bubu
27th February 2008 08:29 UTC
here is a print screen of what i was talking above.
and now instead of:
GetDlgItem $0 $HWNDPARENT 1 i put 1202 and it appears an install button, instead of a close one. geesh
how can i make it to be the finish button, not the install one?