Perhaps the most powerful aspect of LiveCode is the ability to write a small tool or application in a matter of minutes. Even large scale projects can be completed in a fraction of the time it would take to write them in one of the traditional languages. But how can you make your tool or application different to all the others out there? Welcome to the world of 'skinning'! LiveCode makes it easy to transform your application into a rich, visually appealing tool in a few very simple steps.
Our Basic Application
First lets skin the buttons. LiveCode allows you to associate a number of images to a button. This is done using the properties palette of the button in the 'Icons & Borders' section. We will use two of these associations in this tutorial:
Icon - The image displayed in the button's default state
Hover Icon - The image displayed when the mouse is moved over the button
Next we need to choose two images, a standard state and a rollover state for each button. To associate them to a button, we have to import them as controls to the stack. A standard way to do this is to create another card, in this case a second card called images, onto which we import the images.
The images in this tutorial were produced in Photoshop, but there are many places where great icon sets can be purchased and even applications that let you build your own icons. Note: You must use images that have transparent edges for this tutorial to work, .png and .gif files are ideal.
Go to File > Import as control > Image File
and import all the images you will use in your stack.
Note: All the images used in this lesson are contained in the zip file associated with the lesson, the images can be found in the button images folder.
We can now return to the 'player' card and associate all of the images to the buttons. Open the properties palette of the first button and select 'Icon & borders'.
* Click on the wand to the right of the Icon field which will open the image chooser.
* From the pull down menu, select 'This Stack' which will display all images located anywhere within this stack, including our 'images' card.
* Then choose the image you want as the standard state for the button.
Repeat these steps for the hover state by clicking on the wand to the right of the 'Hover Icon' field and then repeat the whole process for each button on the remote control.
Setting button properties
To make the buttons blend into the background we have to alter one or two of the buttons basic properties.
In the buttons properties palette, select 'Basic Properties' from the pull down menu and change the style of the button to 'Transparent Button' and uncheck the 'Show name' property.
In the 'Icons and Borders' pane turn off the checkboxes for Three D, Border and Hilite Border and set the Border Width to 0.
Then resize the buttons so you can see the whole image and spread them out.
Like buttons, it is possible to associate an image with a stack. We do this in a similar way to the skinning of buttons but the stack will take on the shape and transparency properties of the image.
* Import the image as a control, this time to the main card.
* Bring up the images property inspector and select 'size and position' from the menu.
* Set the layer of the image to 1
Now open the stack inspector. Select 'basic properties'. You will notice a property called Shape which has a wand button just like the 'icon and borders' of the buttons. Use it to select the image you have just imported.
Your stack should now be the same shape as the image. You may need to line up both the background image and your buttons to the new window shape.
You will notice that you no longer have access to the minimize and close stack buttons available in a normal window panel. Create two buttons, one to close the stack, the other to minimize it. Set the script of the close button to
the script of the minimize button to
set the iconic of this stack to true
And there you have your fully skinned remote control.