Archive: displaying a bitmap via InstallOptions


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


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.


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?


Still missing full path in MUI_INSTALLOPTIONS_WRITE. The WriteINIStr is also incorrect because you've used "[Field 5]" instead of just "Field 5".


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.


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.


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.


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.


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


Attach ioB.ini as well.


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.


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.


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.


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?


It shouldn't. It should be the path to the image when InstallOptions loads. Something else must be different.