SkinnedControls plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
Line 17: Line 17:


This plug-in started as a part on UltraModernUI, but later several changes had been made into it.
This plug-in started as a part on UltraModernUI, but later several changes had been made into it.
I am using this plugin for creating cool-looking Graphical Installers: [http://www.unsigned-softworks.sk/installer www.unsigned-softworks.sk/installer] (see image below) so I fixed some bugs in this plug-in.


[[File:SkinnedControls-Example.jpg]]
[[File:SkinnedControls-Example.jpg]]

Revision as of 16:49, 24 March 2011

Download Link

v1.0 by SuperPat Zip.gif Download from this forum thread (XXX KB)

or

v1.1 by Tallmaris Zip.gif Download in this forum thread (235.2 KB)

or

v1.2 by Slappy SkinnedControls-v1.2.zip (186 KB) Forum thread for this version


Description

This plug-in allows to skin ALL installer's buttons - even those on nsDialogs page. Also it allows to skin Scrollbars and added possibility to select color for texts on buttons.

This plug-in has several versions - each version was created by another person, so there might be a large differences between them! There are also several builds - an Unicode and normal version and so on! Be careful what version you use!

This plug-in started as a part on UltraModernUI, but later several changes had been made into it.

I am using this plugin for creating cool-looking Graphical Installers: www.unsigned-softworks.sk/installer (see image below) so I fixed some bugs in this plug-in.

SkinnedControls-Example.jpg

How To Use

See example and documentation in {UltraModernUI package}\Examples\SkinnedControls\Example_MUI.nsi from http://forums.winamp.com/showpost.php?p=2483668&postcount=165

SkinnedControls::skinit Function

Skins the installer's buttons and scrollbars with selected bitmaps and sets colours for texts on buttons.

Syntax

; Skin the button
 
Function .onInit
  InitPluginsDir
  ; Extract bitmaps for buttons
  File "/oname=$PLUGINSDIR\button.bmp" "${NSISDIR}\Contrib\SkinnedControls\skins\defaultbtn.bmp"
  File "/oname=$PLUGINSDIR\scrollbar.bmp" "${NSISDIR}\Contrib\SkinnedControls\skins\defaultsb.bmp"
FunctionEnd
 
Function myGUIInit
  ; start the plugin
  ; the /disabledtextcolor, /selectedtextcolor and /textcolor parameters are optionnal
  SkinnedControls::skinit /NOUNLOAD \
			/disabledtextcolor=808080 \
			/selectedtextcolor=000080 \
			/textcolor=000000 \
			"/scrollbar=$PLUGINSDIR\scrollbar.bmp" \
			"/button=$PLUGINSDIR\button.bmp"
  Pop $0
  StrCmp $0 "success" noerror  MessageBox MB_ICONEXCLAMATION|MB_OK "SkinnedControls error: $0"
  noerror:
FunctionEnd

Parameters

/disabledtextcolor=808080

Color of text when button is disabled (Format is in hex: RRGGBB as CSS colors)

/selectedtextcolor=000080

Color of text when button is being clicked (Format is in hex: RRGGBB as CSS colors)

/textcolor=000000

Color for normal state of button (Format is in hex: RRGGBB as CSS colors)

"/scrollbar=$PLUGINSDIR\scrollbar.bmp"

Scrollbar image (several little images in one file)

"/button=$PLUGINSDIR\button.bmp"

A 47x45 image file containing three button images of 47x15 each, the first button image is used when the button is not clicked, the second being the button image used when the button is clicked by the user and the third image is used for disabled state.

SkinnedControls::unskinit DLL Function

Releases the plug-in resources.

Syntax

Function .onGUIEnd
  ; stop the plugin
  SkinnedControls::unskinit
FunctionEnd

Problems

  • During the installation, the button "Show Detail" is unskinned => this issue was fixed in version 1.1.
  • When you use MessageBox function on some page (or some other pop-up windows like Banner plug-in), the next page's buttons got unskinned:

SkinnedControls-bug.jpg

This issue has been fixed in version 1.2, but it is a little tricky:

MessageBox MB_OK "This message causes SkinnedControls bug..." 
; After clicking OK the buttons lost their skin
 
SendMessage $HWNDPARENT ${WM_MENUDRAG} 0 0 ; Do this to force reskin

I used WM_MENUDRAG message [which is normally unused] to notify window to put another refresh message into queue -> to force redrawing. See the source code how it works.

  • If you use Unicode build of this plugin with non-Unicode NSIS (and vice versa) you can get this error (mentioned in this forum):

SkinnedControls-error.png

Use appropriate build of plug-in to solve it (Unicode SkinnedControls + Unicode NSIS and so on).

  • When the plug-in is used, if you used this code line:
SendMessage $HWNDPARENT "0x408" "-1" ""

to automatically return to the previous page, the installer will crash.

Versions History

1.2 (2011)
  • Fixed unskinning buttons after MessageBox is shown (see above)
  • Project was converted to Visual Studio 2008 format
1.1 (2010)
  • Littles bug fixes & Unicode build
1.0 (2009)
  • First version

Credits