Archive: Custom Page


Custom Page
Is it possible when I use modern UI to make a custom page without the Header ?


[Settings]
NumFields=#
Rect=1044

See IO documentation,

http://nsis.sourceforge.net/Docs/Ins...ns/Readme.html


Thanks


I have one very small problem with it.

When I work your way everything work great but at the bottom of the screen where there is usually "Nullsoft installation system" line this line is cut in half so I dont see the upper half of the line.

Is it possible to remove this line at all somehow or make someohow that my screen wont overlap it?


http://nsis.sourceforge.net/Docs/Chapter4.html#4.8.1.6


Thanks again


How about if you want the "content area" to have a white background like the MUI_PAGE_WELCOME and MUI_PAGE_FINISH?

I've tried putting a white bitmap in the "content area" but the labels for the checkboxes that I've included are still gray.

Is there a better way to do this?


Use SetCtlColors to set its background color. In the show callback function of the page, read HWND from the INI file and use it with SetCtlColors.


Hi kichik

Sorry.. I'm a bit confused esp about handles.. This is what I did...

in file.nsi

GetDlgItem $asd $HWNDPARENT 1
SetCtlColors $asd 0x000000 0xFFFFFF


in options.ini
[Settings]
NumFields=7
Rect=1044
HWND=asd


Think it's wrong :eek:

Usage: GetDlgItem $(user_var: handle output) dialog item_id
Error in script

You probably forgot to define $asd using Var.

But you don't need GetDlgItem and 1 is the identifier of the Next button and not of your control. Use ReadINIStr or MUI_INSTALLOPTIONS_READ to get the HWND value of your Field. Open the INI file in $PLUGINSDIR when the installer is running and you'll see.

To find out where $PLUGINSDIR is, simply MessageBox it after it's initialized. You can manually initialize it using InitPluginsDir or use it after the custom page was already displayed.


Hi kichik.

I now see that it's generated for you. :)

But I still can't read the value.

ReadINIStr $asd "ioC.ini" "Field 3" "HWND"
ReadINIStr $asd "$PLUGINSDIR\ioC.ini" "Field 3" "HWND"
!insertmacro MUI_INSTALLOPTIONS_READ $asd "$PLUGINSDIR\ioC.ini" "Field 3" "HWND"


Neither of these return the value of HWND, unless I manually set the value in the original ioC.ini file which is wrong, I know.

Then you're either using a very old version of NSIS or you're reading the value before the page is actually created. Use it after MUI_INSTALLOPTIONS_INITDIALOG. If you're using MUI_INSTALLOPTIONS_DISPLAY, split it to MUI_INSTALLOPTIONS_INITDIALOG and MUI_INSTALLOPTIONS_SHOW.


Thanks kichik :D

As always, letting me find my way without leading me by the hand. I always learn a lot from you. :)

Cheers :D

For the benefit of the rest:

in script.nsi (replace Field X with the name of the field)


Var $avarname

Function PageFunction
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioC.ini"
ReadINIStr $avarname "$PLUGINSDIR\io.ini" "Field X" "HWND"
SetCtlColors $avarname 0x000000 0xFFFFFF
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd


in io.ini
Nothing extra

Now I have a related question.

Why is my white bitmap image of size 250x200 and monochrome at [Field 1] appearing above the other fields and not displaying.

I made one also at 600x600 but that covered up almost the entire screen even though i put the left, top, etc at different coordinates.


If it's not appearing, you probably didn't extract it and set the State value of the Bitmap control correctly. You must set State at runtime so InstallOptions can find the image.

The controls are created sequentially from Field 1 to the last field so the first control should be behind everything. Are you sure it's really Field 1 that's hiding the second group box?


This is my ioC.ini


[Settings]
NumFields=8
Rect=1044
NextButtonText=Finish

[Field 1]
Type=Bitmap
Text=white.bmp
Left=130
Right=313
Top=32
Bottom=180
State=1

[Field 2]
Type=Groupbox
Text=Shortcuts
Left=117
Right=315
Top=52
Bottom=93

[Field 3]
Type=Groupbox
Text=Additional
Left=117
Right=315
Top=109
Bottom=148

[Field 4]
Type=checkbox
Text=Create shortcut on the Desktop.
Left=126
Right=288
Top=64
Bottom=76
State=0
HWND=

[Field 5]
Type=checkbox
Text=Create shortcut in the Start Menu.
Left=126
Right=300
Top=76
Bottom=88
State=1

[Field 6]
Type=Checkbox
Text=Start the program once done.
Left=126
Right=272
Top=124
Bottom=132
State=1

[Field 7]
Type=Bitmap
Text=win.bmp
Left=0
Right=110
Top=0
Bottom=193

[Field 8]
Type=Label
Text=Additional configuration
Left=109
Right=316
Top=0
Bottom=47


State=1 added to [Field 1] to no avail. As you can see, the other bitmap displays fine.

Sorry, you must set Text correctly, not State. State means nothing for Bitmap controls. You must set Text to where you've extracted the image or InstallOptions won't be able to find the image. You must use WriteINIStr or MUI_INSTALLOPTIONS_WRITE on runtime to write the path where the image was extracted.


oooo

I think I've got the general idea. Was under the impression that it was all automatic.

Thx :)


Image displays but is still on top. Any ideas?

Function onInit
InitPluginsDir
File /oname=$PLUGINSDIR\white.bmp "white.bmp"
FunctionEnd

Function CustomPageC
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioC.ini" "Field 1" "Text" "$PLUGINSDIR\white.bmp"
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "ioC.ini"
FunctionEnd

Attach the script and the INI file. As said earlier, this shouldn't happen as the first field is created first.


Attached


File is attached here


Is that still for the white background? You don't need a bitmap for that... Get the HWND of the InstallOptions dialog and use SetCtlColors on that. Use MUI_INSTALLOPTIONS_INITDIALOG_RETURN and Pop the result which is the HWND.

As for the bitmap, my bad again. The last Field goes on the bottom of the Z-order. From MSDN:

If the created window is a child window, its default position is at the bottom of the Z-order. If the created window is a top-level window, its default position is at the top of the Z-order (but beneath all topmost windows unless the created window is itself topmost).
So Field 1 should be Field 8.

Hey again Kichik.

That about solves it :)

But there is "no such macro MUI_INSTALLOPTIONS_INITDIALOG_RETURN".

Will just stick with the bitmap :)


Right, then MUI_INSTALLOPTIONS_INITDIALOG already pushes the HWND to the stack. Even if you stick with the bitmap, you should Pop that value to avoid stack corruption.


script updated..

Thx again :)