pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Bartlett <cbartlet...@gmail.com>
Subject Re: Applying a style to all elements of a control
Date Tue, 22 Mar 2011 20:15:39 GMT
On 23 March 2011 01:45, Bill van Melle <bill.van.melle@gmail.com> wrote:

> If the only way to change the style of, say, a Label is to change the style
> of *all* Labels, then that's pretty useless to me.  That's more of a global
> skinning facility.
As the example demonstrates, you can create named styles (heading &
subHeading). or typed styles (Button, RadioButton, PushButton).

> I don't object to having a style name per BXML file, but it's unclear to me
> how I make use of it.  Sorry if I'm being obtuse here.
Look at the example.

<Label styleName="heading" text="Heading Text"/>
<Label styleName="subHeading" text="Sub-Heading Text"/>

These named styles exist in the JSON stylesheet.
2 Labels are styled differently by referencing different named styles.

I haven't looked at the internals of the
ApplicationContext.html#applyStylesheet(java.lang.String) method, but you
might be able to have multiple style files and apply them one after another
into the named & typed style maps.  How you choose to build up those maps is
up to you.  ScriptApplication accepts a --stylesheet argument and uses the
JSON file it points to.

You can define the styles in one (or maybe more) stylesheets as named
styles, and use them alter the appearance of relevant Components wherever
they might be.
You could use a naming convention of your choosing if you want to 'bundle' a
group of named styles together for use in a specific BXML file.


View raw message