- NSIS Discussion
- displaying a bitmap via InstallOptions
Archive: displaying a bitmap via InstallOptions
Fuzzybunny
6th February 2007 20:47 UTC
displaying a bitmap via InstallOptions
What I'm trying to accomplish is to have a bitmap beside the radio button. I've browsed through the forums and tried the various suggestions but they don't seem to work for me.
Function .onInit
;Extract InstallOptions INI files
InitPluginsDir
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Field 5" "Type" "Bitmap"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Field 5" "Text" "image.bmp"
File /oname=$PLUGINSDIR\image.bmp "c:\image.bmp"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioB.ini"
FunctionEnd
Function ChooseCamera
; WriteIniStr $PLUGINSDIR\io.ini "[Field 5]" Text $PLUGINSDIR\pgr.bmp
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"
FunctionEnd
Nothing gets written to the ioB.ini file from either the MUI_INSTALLOPTIONS_WRITE or the WriteIniStr. I can't seem to get it to write. Can someone enlighten me? Thanks
kichik
6th February 2007 20:49 UTC
You are writing to the INI file before you extract it using MUI_INSTALLOPTIONS_WRITE. That means the extraction will overwrite whatever you wrote. The Text you specify also doesn't contain the full path as required.
With WriteIniStr, you wrote to the wrong INI file and again the wrong path. It should be $PLUGINSDIR\image.bmp and not $PLUGINSDIR\pgr.bmp.
Fuzzybunny
6th February 2007 21:35 UTC
ahh sorry typos, with your corrections it would be:
Function .onInit
;Extract InstallOptions INI files
InitPluginsDir
File /oname=$PLUGINSDIR\image.bmp "c:\image.bmp"
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioB.ini"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Field 5" "Type" "Bitmap"
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Field 5" "Text" "image.bmp"
FunctionEnd
Function ChooseCamera
; WriteIniStr $PLUGINSDIR\ioB.ini "[Field 5]" Text $PLUGINSDIR\image.bmp
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"
FunctionEnd
Sadly, both methods still do not work. Am I missign something?
kichik
6th February 2007 21:39 UTC
Still missing full path in MUI_INSTALLOPTIONS_WRITE. The WriteINIStr is also incorrect because you've used "[Field 5]" instead of just "Field 5".
Fuzzybunny
6th February 2007 21:45 UTC
ya sorry it's suppose to be "Field 5", i was trying things.
I added the full path to the bmp in MUI_INSTALLOPTIONS_WRITE so it is now:
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Field 5" "Text" "c:\image.bmp"
but still nothing is being written. I would imagine that even if I got it wrong, something should still have been written to ioB.ini.
kichik
6th February 2007 21:50 UTC
That's not the full path on the user's computer. That's the full path on your computer. Just as with WriteINIStr, it should be $PLUGINSDIR\image.bmp.
Red Wine
6th February 2007 21:59 UTC
What about "The position on the dialog where this control appears. All sizes should be set in dialog units." Left, Right, Top, Bottom, all required.
Fuzzybunny
6th February 2007 22:02 UTC
Ok I've modified again with
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Field 5" "Text" $PLUGINSDIR\Image.bmp
and
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioB.ini" "Field 5" "Text" "$PLUGINSDIR\Image.bmp"
still nothing. Nothing being displayed and nothing is being written to the ioB.ini file.
I've attached my file for everyone to look at. There's probably some ofther unrelated errors in there lol, but my main concern is trying to display the bitmap.
Fuzzybunny
6th February 2007 22:06 UTC
My ioB.ini file looks like this (sorry couldn't attach it)
[Settings]
NumFields=5
[Field 1]
Type=RadioButton
Text=Camera1
Left=10
Right=-1
Top=0
Bottom=10
[Field 2]
Type=RadioButton
Text=Camera2
Left=0
Right=-1
Top=10
Bottom=40
[Field 3]
Type=RadioButton
Text=Camera3
Left=0
Right=-1
Top=40
Bottom=70
[Field 4]
Type=RadioButton
Text=Camera4
Left=0
Right=-1
Top=70
Bottom=100
[Field 5]
Type=Bitmap
Left=50
Right=-1
Top=0
Bottom=10
kichik
6th February 2007 22:07 UTC
Attach ioB.ini as well.
kichik
6th February 2007 22:09 UTC
The image is overlapping all of the other controls. Try using Top=100 for the image. You should use a GUI editor like HM NIS's and EclipseNSIS's to edit IntsallOptions dialogs. It's much easier that way.
Fuzzybunny
7th February 2007 14:37 UTC
I tried it at 100, still nothing. I'm still concerned that my nothing is being written to my ioB.ini file. Even if the numbers, paths, or file names are wrong, it should still have been written to the ioB.ini file. Unless I'm misinterpreting what either Write command does. I will look at the 2 GUI editors, but I'm afraid they won't solve the write issue.
Backland
7th February 2007 15:13 UTC
Just open the ioB.ini file in $PLUGSINSDIR with a call to ExecShell after you finish writing to it, then you should see what it looks like right before you pass it to IO.
Fuzzybunny
7th February 2007 15:41 UTC
Ok so for reasons unknown to me, after i tried the HM NIS editor for the ioB.ini file, my bmp showed up. The only difference that i see is that it did this:
[Field 5]
Type=Bitmap
Text=Bitmap
where before I used the Text parameter for the path of the Bitmap as per documention. Thanks for the help everyone. Can someone explain to me as to why Text should be Bitmap and not the path?
kichik
8th February 2007 20:27 UTC
It shouldn't. It should be the path to the image when InstallOptions loads. Something else must be different.