Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread How dynamic are control interfaces?
Mon, Jan 26 2015 8:05 AMPermanent Link

Rick

Hi.

I've seen the video that Tim created to demo the new control interfaces
which replace themes in EWB2. I can see how they would be included in a
project and used to set the interface based properties of a component at
run time (e.g. TButton background color).

This is probably an extreme example but what if I have five TButtons on
a form and I want them to be all different sizes and colors? Would I
need to include five different interfaces with each button associated
with the interface I want? Is there a way to dynamically manipulate the
individual properties of an interface directly at runtime so that I can
alter the look of the control independently of the provided interface(s)?

I guess interfaces will just end up being a CSS class that gets applied
to a control in the DOM. I just wonder how flexible they are at runtime.

--
Rick
Mon, Jan 26 2015 2:07 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Rick,

<< This is probably an extreme example but what if I have five TButtons on a
form and I want them to be all different sizes and colors? >>

Sizes are never an issue (by default), but colors can be an issue depending
upon how the button interface is done.  The default TButton uses a gradient,
so it has to do things like reverse the gradient and add inset shadows when
pushed, etc. in ways that make allowing the developer the ability to choose
the color difficult.

However, you can easily define a TButton descendant called TFlatButton that
uses the TFlatButton interface, re-define the interface to only apply a
default color, and then surface the background color as a published
property, and you would be all set.

<< Would I need to include five different interfaces with each button
associated with the interface I want? >>

No.  With interfaces, you can control how each interface is initialized and
which interface properties are applied by the various state transitions.
Therefore, you can completely control which properties are "ignored" during
state transitions, and one of these can be the background.

<< Is there a way to dynamically manipulate the individual properties of an
interface directly at runtime so that I can alter the look of the control
independently of the provided interface(s)? >>

Yes, but I wouldn't do it that way.  There's about 4 different ways that
interfaces can be modified, but the most ideal way if you're not just
re-skinning the default controls is to use a descendant class with a
descendant interface class name.

<< I guess interfaces will just end up being a CSS class that gets applied
to a control in the DOM. >>

No, EWB 2 does not use CSS classes.  They're too difficult to interrogate,
and some browsers like Chrome give you trouble when trying to interrogate
them on local file systems due to "security concerns".  EWB applies the
interfaces to UI elements dynamically at runtime, and each UI element can
override how the interfaces are translated into CSS style modifications.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Jan 27 2015 1:50 AMPermanent Link

Rick

On 27/01/15 06:07, Tim Young [Elevate Software] wrote:
> about control interfaces.
>

Thanks Tim. I'm looking forward to trying this all out for myself.
Sounds very powerful.

--
Rick
Image