Skinning

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.

Download stack and resources here:

https://tinyurl.com/yaqpl948

Our Basic Application

Our Basic Application

So lets start off with the stack that we want to skin. A common application that is really lifted when skinned is a remote control.

Create a new stack called Remote Control and add Play, Prev, RW, Pause, FF and Next buttons. Resize these buttons to the the sizes you want. Align them if you wish using the Align Control tab in the Property Inspector - to do this you need to select all the controls together.

Skinning Buttons

Skinning Buttons

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' section (1). We will use two of these associations in this tutorial:

Icon (2) - The image displayed in the button's default state

Hover Icon (3) - The image displayed when the mouse is moved over the button

Importing Images

Importing Images

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. Create a new card from the Object menu.

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. Instead of importing them one by one, you can import them using "All Images in Folder..."

Associating Images

Associating Images

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 'Icons' (1).

* Click on the button to the left of the Icon field (2) which will open the image chooser.

* From the pull down menu, select 'This Stack' (3) 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 (4).

Repeat these steps for the hover state by clicking on the wand to the right of the 'Hover Icon' (5) 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 the 'Basic' tab (1) and change the style of the button to 'Transparent Button' (2) and uncheck the 'Show name' (3) property.

Turn off the checkboxes for 3-D (4) and Show border (5) and set the Border Width to 0 (6). On the Icons pane, uncheck Hilite Border.

Then resize the buttons (7) so you can see the whole image and spread them out.

 

Setting button properties

Skinning Stacks

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

You may notice that your stack size is a bit small for the background image, lets fix that.

Open the stack inspector. Select Position, and change the width and height to a size that shows all of the image. Now select the 'Basic' tab. You will notice a property called Shape which has a button just like the icons for 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. Edit the properties to make the buttons transparent (1) turn off show name (2) and remove borders (3).

 

Open the code editor from the toolbar, and set the script of the close button to

on mouseUp
	quit
end mouseUp

the script of the minimize button to

on mouseUp
  set the iconic of this stack to true
end mouseUp

And there you have your fully skinned remote control.

Skinning Stacks

13 Comments

Ramiro Ernesto Crespo Melgar

how do you move the skinned app, there seems t be no area to move it around the screen
please help

Van Brollini

ok, where is the icon and borders section and how do you put the buttons on the stack. is it the same as the last lesson?

Elanor Buchanan

Hi Ramiro

If you look at the script of the "player.png" background image you can see how the stack is moved. It is not covered in the lesson but hopefully it makes sense. It just uses the location of the mouse to reset the location of the stack while the mouse is being held down and moved.

I hope that helps.

Elanor

Elanor Buchanan

Hi Val

You get to the Icons and Borders section by selecting a button using the Edit tool, opening the Property Inspector from the Tool Bar and then selecting "Icons and Borders" from the drop down menu in the Property Inspector.

You add the images you want to use for the buttons to the stack using "Import As Control" from the File menu as described in Step 3 - Importing Images. You can then assign these icons to the buttons as described in Step 4 - Associating Images.

I hope that helps.

Elanor

Tom J

Where do I get the button images file? Nothing came with this lesson.

Ben Beaumont

Hi Tom,

You'll find a link at the top of the lesson "remoteControl.zip" under the title "Attached Files".

I hope that helps.

Warm regards,

The RunRev Team

Mike Manley

Elanor,

Thank you for answering our questions. In the lesson above it states that a new card called images is required to which the images files are imported as controls. How is this new card created and named?

Ben Beaumont

Hi Mike,

There is lesson on adding a new card here:

http://lessons.runrev.com/s/lessons/m/4067/l/31933-How-do-I-add-another-card-to-my-stack-

If you right click / apple click on the card and open the 'property inspector', you can name change its name in the palette that pops up.

I hope that helps.

Warm regards,

The RunRev Team

Jerry

Hi, i created some nice button images. But whatever i do, on Android i still see a thin black square border around each button, and it looks like the size which you can pull to set it's size. I disabled: Show Focus Border, Three D, Border, Hilite border. Used Transparent Button as style type. Any other clou which could remove that unwanted border? I don't want to use Mobgui. I think it has to work right from Livecode itself. Thanks for any help on this. Kind regards, Jerry

Elanor Buchanan

Hi Jerry

Try setting the Border Width to 0 in the Icons & Borders pane of the Property Inspector, that's the only other relevant property I can think of that you haven't already set.

If that doesn't help you can email your stack to support@livecode.com and we'll take a look at it.

Kind regards

Elanor

Jerry

Hi Elanor, yes! that did the trick.

Thanks a lot! You're the best :)

Kind regards,
Jerry

noorizan mohd esa

hello sir,
i need your help. how to use image gif in skinny button?

Elanor Buchanan

Hi, to use a gif image you import it into your stack using File -> Import as Control -> Image Control. Then you set the icon property of your button to the ID of the imported image.

I hope that helps,

Elanor

Add your comment

E-Mail me when someone replies to this comment