Tips & Tricks - SmartButtons

SmartButtons are a great addition to any skin as they provide the user with additional flexibility. There are 2 key benefits to SmartButtons:

  1. The presence of normal buttons in a skin is determined by the skin creator, but a skin author can add SmartButtons and then the user can choose whether or not they wish them to be visible.
  2. SmartButtons introduce plug-ins which provide additional functionality to your skin

The plug-ins which are installed by default with WindowBlinds :

Always on top – your window will always remain on top of others (aot . wbp)
Quicklaunch – display contents of your Quick Launch folder (quickl . wbp)
Rollup – roll up the window to minimize the space taken (rollup . wbp)
URL – launch a specific URL (url . wbp)

The first things you need to consider are the graphics for your SmartButtons. WindowBlinds provides a default graphic for each plug-in, but you can add code to specify an alternative graphic. You need to specify code for each plug-in but it is very simple.

The format is:

[smartbutton.PLUGINNAME]
Image=IMAGEFILE

e.g.
[SmartButton.rollup]
Image=MySkinDirectory\rollup.bmp

In addition to sections for each of the 4 built in plug-ins, you can also have a [SmartButton.generic] section which caters for any other plug-ins that you may have. The format for these images is a ten-state image:

  • Active Normal
  • Active Pressed
  • Active Mouse over
  • ActiveState
  • Active State Pressed
  • Active State Mouse over
  • Inactive Normal
  • Inactive Mouse over
  • Inactive State
  • Inactive State Mouse over

The next thing you need to do is create a plug-in button for each SmartButton you want to create just as you did earlier.

[Button17]
Align=1
XCoord=97
YCoord=6
Alpha=254
Width=19
Height=18
Action=-3
ShiftAction=0
CtrlAction=0
DllName=smart.dll
SmartButtonNumber=0
Visibility=14
OutSound=Logika\roll.wav

[Button18]
Align=1
XCoord=115
YCoord=6
Alpha=254
Width=19
Height=18
Action=-3
ShiftAction=0
CtrlAction=0
DllName=smart.dll
SmartButtonNumber=1
Visibility=14
OutSound=Logika\roll.wav

The only line that you may find unfamiliar is the SmartButtonNumber reference. This is simply a pointer to the section of code you see below and ties the button to the specific SmartButton code.

[SmartButton0]
Enabled=1
WIDTH0=20
NAME0=URL Button
DLL0=url.wbp
Author0=Neil Banfield

[SmartButton1]
Enabled=1
WIDTH0=20
NAME0=Quicklaunch Button
DLL0=quickl.wbp
Author0=Neil Banfield

Each SmartButton has a section of its own entitled [SmartButtonX]where X is the number given is the above SmartButtonNumberreference.

The code lines are actually fairly self explanatory:

Enabled=             Set this to 1 to enable the button, 0 to disable it
WIDTH0=              Give the button a width
NAME0=               Give the button a name for reference
DLL0=                Specify which plug-in (.wbp) the SmartButton should use
Author0=             Enter the plug-in author (optional)

That is all the code you need. Your SmartButtons should now be visible in your skin and the functionality will be built in.

Now that the SmartButtons are created the user can customize them in the WindowBlinds Advanced Configuration dialog. In Windows XP this is accessible by clicking the WindowBlinds button on the Appearance tab (where you normally select your skins) of the Display Control Panel.

 When your skin is loaded, the SmartButtons section will display information about the plug-ins in your skin.

Clicking the Configure button will allow you to edit any options that exist for the plug-in. Once you have selected the SmartButton you wish to edit, clicking Configure brings up a dialog which allows you to specify whether you actually wish to edit the settings, or change the button to use a completely different plug-in.

For example, configuring the URL Button will allow you to specify which web address you wish to be launched when the button is clicked.
If you then go on to configure, you can specify the web page to be launched.

That’s all you need to know to make your own SmartButtons.

(c) 2002 Stardock.net