SkinnedControls plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Created page with "== Download Link == Image:Zip.gif [http://forums.winamp.com/showpost.php?p=2483668&postcount=165 http://forums.winamp.com/showpost.php?p=2483668&postcount=165] (XXX KB) - v1....")
 
mNo edit summary
Line 18: Line 18:
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.


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


== How To Use ==
== How To Use ==
Line 87: Line 87:
* When you use MessageBox function on some page, the next page's buttons got unskinned:
* When you use MessageBox function on some page, the next page's buttons got unskinned:


[[File:SkinnedControls-bug.png]]
[[File:SkinnedControls-bug.jpg]]


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

Revision as of 07:38, 23 March 2011

Download Link

Zip.gif http://forums.winamp.com/showpost.php?p=2483668&postcount=165 (XXX KB) - v1.0 by SuperPat

or

Zip.gif http://forums.winamp.com/showpost.php?p=2735682&postcount=240 (235.2 KB) - v1.1 by Tallmaris

or

Zip.gif http://forums.winamp.com/showpost.php?p=2756948&postcount=6 (XXX KB) - v1.2 by Slappy


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.

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, 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.

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