PDA

View Full Version : Multiple State Buttons?



NeoMorph
November 1st, 2007, 09:54 AM
When you add a new state to a button it says "State 1" but doesn't allow you to add any new states. It would be useful to be able to add State 2... State n... etc. I can do it with multiple buttons but would be useful to do it with a single button.

For instance I have a button that is State 1. visible, State 2. highlighted and State 3. invisible.

Rob H
November 1st, 2007, 10:29 AM
I'd agree with that - one for the requested features list. Although I'm not sure what should happen if you have two states that satisfy the same conditions, presumably the first one that matches should apply.

NeoMorph
November 1st, 2007, 11:27 AM
I'd agree with that - one for the requested features list. Although I'm not sure what should happen if you have two states that satisfy the same conditions, presumably the first one that matches should apply.

You could use...

if State 1 then ...
if State 2 then ...
if State 3 then ...
if State 4 then ...
if State n then ...
else Default

That way no 2 states would match. I have one button that is actually using 4 states atm and I got around it with using blanking buttons.

1. Queue
2. UnQueue
3. Highlights UnQueue (for when playlist is on that item)
4. No Action (Invisible)

It took only two buttons but with a multi-state one I could have done...

Case Action
== "Queue"
== "UnQueue" and CurrentSong
== "UnQueue"
== "NoAction"

As you say, something for future. It's not a priority but would make life a lot easier.

One thing I just thought about... Can you check what state the button is in currently? If not, add it to the feature request as it would be useful to know what has been pressed.

Rob H
November 1st, 2007, 11:33 AM
Yes, you can discover the state of a button - see the help for Lua library reference\NetRemote library. If I remember correctly it's the GetState() method of an element.

NeoMorph
November 1st, 2007, 11:40 AM
Oh yeah and allowing different fonts and sizes for each state... god knows I'm in "what I'd love" mode...

I make the font into a monospaced version and slightly larger when it's highlighted... Unfortunately trying to get it just right means you have to use two frames with two different setups to get it right and in NRD it looks jumbled even though it's perfect at runtime...

http://www.neomorph.net/promixis/lining%20up%20text.png

Not the cleanest of layouts...

NeoMorph
November 1st, 2007, 11:47 AM
Yes, you can discover the state of a button - see the help for Lua library reference\NetRemote library. If I remember correctly it's the GetState() method of an element.

Typical... I was looking for StateGet.

I cheated. I added a Lua script when the button is pressed before the LMAuto.. basically I set a public variable and OnPressed checks it before deciding what to do.

Barf
November 1st, 2007, 01:54 PM
A few months ago, I was annoyed by this, without getting my self together to complain to the forum. As far as I recall, the documentation gives the impression that the number of states is not limited to two.

So, please either allow more states (preferred), or have the documentation state the limitation.

Rob H
November 1st, 2007, 02:06 PM
I think Ben's intention was to allow more than two states, but it never happened for various reasons.