On 6/1/13 3:28 AM, "flexcapaci...@gmail.com" <flexcapaci...@gmail.com>
wrote:

>I've been coming across more and more cases where it would be great to
>have
>support for multidimensional states. What this looks like and how it's
>used
>I'm not sure. Maybe we can discuss ideas.
Yes, let's discuss.  I'm actually finishing up getting simple states to
work in FlexJS. I haven't started work on StateGroup because I wasn't sure
how often they are used and whether they are considered the "right"
solution by folks.
>
>I'd really like to know what the Flex team was
>talking about when they mentioned this.
It wasn't the "Flex team", it was just me.  Before we get into proposals,
I'd like to collect a set of scenarios, so we have something concrete to
apply the proposals to.

The only time I think I ran into this was with Button.  A standard push
button in Flex (and other OS's) changes its look not only on
up/down/hover/disabled, but also whether it is the "default" button for a
form, and then again when it has focus.  Things like focus visuals in
current Flex are not applied via states for the reason that it exploded
the number of skin states the designer would have to create, and I think
that StateGroups weren't up to the challenge either.  There is another
case involving Panel.

For Button, if you want to specify the focus appearance in the "skin" as
well, you end up with the following states (not including disabled states):

Up
Down
Over
UpAndDefault
DownAndDefault
OverAndDefault
UpAndFocused
DownAndFocused
OverAndFocused
UpAndDefaultAndFocused
DownAndDefaultAndFocused
OverAndDefaultAndFocused

The focused appearance is often different between UpAndFocused and
UpAndDefaultAndFocused, so I don't think a StateGroup applies well, and
the focused appearance may not change between Up/Down/Over.  But maybe
there is a way to make StateGroup work here.

For Panel, I think if you look in PanelSkin you see code in
updateDisplayList that considers borderVisible and sets content offsets.
A lot of the code in the skins are a "punt" on states.  States would have
allowed declarative, non-code ways of describing all of the visuals, but I
think it would have exploded as well.  Panel would have states like:

Normal
Disabled
NormalWithControlBar
DisabledWithControlBar
NormalWithBorder
DisabledWithBorder
NormalWithBorderAndControlBar
DisabledWithBorderAndControlBar

I don't have a proposal ready to go.  I was thinking of something called
"conditionals" which I think are just binding statements.  Then for Panel
you could just say contents.borderVisible or something like that.   I'm
not clear that property.state syntax would work or needs to work for
multidimensional states, but I'm open to it.  One "constraint" for FlexJS
right now is that we're trying to get FB and the old MXMLC compiler to
compile your app cleanly so adding other property.state possibilities
without the appropriate mx:State will result in errors and be more work to
implement.  Maybe some other delimiter?  Maybe implement attribute
selectors in CSS?

So, if you can offer up a scenario, then we can see whether StateGroup is
the right answer or if we can come up with something else.

Thanks,
-Alex

Reply via email to