Android Question Statelist AddState order

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Is there a specific order required for adding to a statelist?

I had this code:
B4X:
    mDDButtonStateList.Initialize
    mDDButtonStateList.AddState(mDDButtonStateList.State_Enabled, mDDArrowDown)
    mDDButtonStateList.AddState(mDDButtonStateList.State_Pressed, mDDArrowDown_Pressed)
 
    mDDButton.Background = mDDButtonStateList

In the above code, the Arrow Down showed but did not change when the button was clicked on.

So I (out of the air) swapped the two lines Pressed and Enabled (changed the order I put them in the statelist)
B4X:
    mDDButtonStateList.Initialize
    mDDButtonStateList.AddState(mDDButtonStateList.State_Pressed, mDDArrowDown_Pressed)
    mDDButtonStateList.AddState(mDDButtonStateList.State_Enabled, mDDArrowDown)

    mDDButton.Background = mDDButtonStateList

And now the button works just fine. The Button shows the Arrow and when I press on it the Arrow changes to the Pressed Arrow.

I did not realize that there was any order when adding to the statelist. I just thought the .State_Pressed or .State_Enabled controlled them.

Am I experiencing a flash back to my 60's days (new those drugs would catch up with me) or is this just something I missed or forgot when looking at the user guide.

BobVal
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top