This Question is Answered

14 "helpful" answers available (3 pts)
6 Replies Last post: Jul 20, 2008 5:59 PM by rshiplett

Step-by-step guide to build a skinnable applet

Mar 24, 2008 3:58 AM

Click to view URPradhan's profile Level 7 URPradhan 141 posts since
Mar 6, 2008

Friends

I wanted to build a skinnable applet with API 6.0.

Can anyone will provide what needs to be done to convert an existing applet with skins/style-sheet support ? I saw an applet which can produce a *.scurl skin from a CSV file. But how to use that *.scurl file for skin/style-sheet support ?

//Thanx

Click to view mgordon's profile Curl mgordon 47 posts since
Oct 17, 2007
1. Re: Step-by-step guide to build a skinnable applet Mar 24, 2008 7:28 AM
To use your style sheet you need to delegate to the library in your project manifest, import the library, and call install-style-sheet.

1. Delegate to the styled controls library. You can use the Add Delegate to... command on the Project menu in the IDE or add a delegate-to like the following to the manifest file (usually called manifest.mcurl). The location may differ depending on where you put the library files.

{delegate-to COM.CURL.GUI.STYLED,
    location = "../libs/COM.CURL.GUI.STYLED-6.0-pcurl-en/manifest.mcurl",
    version = "6.0"
}

2. In your applet, import the styled controls package and call install-style-sheet:

{import * from COM.CURL.GUI.STYLED-CONTROLS}
{install-style-sheet {url "my-stylesheet.scurl"}}

There are more examples in the documentation that comes with the library. Use the Install Documentation command from the Help menu in the IDE to install it. There is more about this on the styled controls library page. It also describes what you can put in the style sheet. Let us know if you have other questions.

Click to view URPradhan's profile Level 7 URPradhan 141 posts since
Mar 6, 2008
2. Re: Step-by-step guide to build a skinnable applet Mar 24, 2008 10:44 PM
in response to: mgordon

Thank you for the correct answer.

But how can I change the style dynamically slecting one Style from a drop down list box ?

Alternatively, Can we change the style dynamically after the applet loads ?

Thanx

Click to view friedger's profile MVP friedger 108 posts since
Jan 13, 2008
3. Re: Step-by-step guide to build a skinnable applet Mar 25, 2008 6:40 AM
in response to: URPradhan

There is a procedure {install-style-sheet-on-Graphic} that allows to update the style of an graphic.

Probably you can call this method on the applet graphic as well, something like

{install-style-sheet-on-Graphic {get-the-applet}.document.document-graphic,
{url "abc.scurl"}
}


(haven't tried that)

Friedger

Click to view mgordon's profile Curl mgordon 47 posts since
Oct 17, 2007
4. Re: Step-by-step guide to build a skinnable applet Mar 25, 2008 7:08 AM
in response to: friedger
Friedger's technique is useful if you want to apply a style sheet on a specific object. When you call install-style-sheet, it changes the-default-look-and-feel, so the installed style will apply to any dialogs and views that pop up, as well as to the applet itself.

You can call install-style-sheet any number of times, so you can call it in a ValueFinished handler on a DropdownList if you want to select from a number of styles, like this:

{DropdownList
    "light-blue-style.scurl",
    "blue-enamel-style.scurl",
    {on ValueFinished at ddl:DropdownList do
        {install-style-sheet {url ddl.value asa String}}
    }
}
Click to view URPradhan's profile Level 7 URPradhan 141 posts since
Mar 6, 2008
5. Re: Step-by-step guide to build a skinnable applet Mar 27, 2008 10:40 PM
in response to: mgordon

Hi mgordon

Thank you for your continuing support.

In ur last replay the statement "You can call install-style-sheet any number of times" was very useful.

I request you; if you alreay have the Windows XP like style sheet/skin for controls, plz share with us.

//Thanx again

Click to view rshiplett's profile MVP rshiplett 36 posts since
Oct 17, 2007
6. Re: Step-by-step guide to build a skinnable applet Jul 20, 2008 5:59 PM
in response to: mgordon

Just a note to say that under Curl version 7.0 you no longer need to delegate to get style sheets.

The import is now

{import * from CURL.GUI.STYLED-CONTROLS} || no longer the external pkg COM.CURL/GUI. ...

If I have a start file that does not know it's style on startup then


{install-style-sheet
{ get-default-style-sheet}
}

seems to work fine under 7.0