How to create a skin application
This tutorial will show you how to create a simple skinned application using Win32::GUI::Skin.
For this example, the sample skinfiles skin3.pwgs or skin4.pwgs may be used. They may be found in your Perl directory under site\lib\Win32\GUI\Skin\examples
Before we start with the script, a little bit about the skinfile.
The skinfile defines how the skin will be displayed. This is done when the skin is designed, and cannot be changed at runtime. There is only one area of the skin that you will need to worry about, and that is the application (or app) area. The rest of the skin is out-of-bounds for your script. Think of the app area as the normal rectangle of a standard window.
The skinfile also may contain predefined labels. The 2 example skinfiles contain 2 labels named value and skinvalue2. You may add additional labels at runtime.
OK, lets get started.
You do use strict and warnings, right? Don't forget to use Win32::GUI also!
Now, we create the Window object. It's just like Win32::GUI, with a few additional options.
Now we have a Win32::GUI window like object. Notice the additional options, -skinfile and -startskinned.
-skinfile is the name of the skinfile (it should be in the same directory as this script), and -startskinned => 1 will show the window in skinned mode.
And finally, show the window and start the Dialog.
And that's it, you have have a very simple skin! You can only drag it around, minimize it and close it, but hey, it's cool; it's skinned!
You may notice that there are some labels displayed on the skin. Don't worry about those yet; they are defined in the skin file. The next tutorial will cover what to do with those labels.
Here's the complete script (it's in the examples directory as simple1-1.pl):
As comparison, here is a script that simply displays a normal window:
There are only a few minor differences. When you are using a skin window, and you do not plan on allowing a normal window view, then you do not need to define -width and -height. If you will have a normal window mode, then you should define them. Switching from skin mode to normal mode will be covered soon.
(C) 2006 Brian Millham