|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sun Dec 10, 2006 4:24 am
[1.22] Toggle Button Bug |
Placing a variable or expression in the value box in a toggle button still does not properly change the state/color of a toggle button when the value of the variable or expression changes.
Also and very oddly. Once you have created the button and used it. If you change the name of the variable itself, the value of the button still follows the value of the newly renamed variable.
This is what I did.
On the sessions window hit escape.
Open the package editor.
Create a new Variable named Test.
Set the value of Test to 0.
This is important because if you do not create it first the button ignores it.
Create a new button named Test1.
In the scrip box put
#show This is action 1, Variable value is {@test}
Set the type to Toggle.
Click on the options tab.
Uncheck the Transparent checkbox.
Set the button color to Blue.
Set the Value: to @test
Click the save button. Very Important.
A new state is automatically created for you.
Name it Test2.
Uncheck the Transparent checkbox.
Set the button color to Red.
Click the Script Text tab.
In the script box put
#show This is action 2, Variable value is {@test}
Click the save button.
The First state named Test1 has had the colors reset to black, and the value: reset to blank. Go back and set them as stated above and save.
Now close the package editor, or move it out of the way somehow.
Click the button and notice that the color remains blue.
The output is.
This is action 1, Variable value is 0
The button text changes to be Test2
Click it again and you get this output.
This is action 2, Variable value is 0
At this point the expected behaviour would be for the button to remain blue as it does and for the text to remain Test1. The output should also always be.
This is action 1, Variable value is 0
Click the button a few times and noting both the color of the button and the output.
The button will remain blue but the text will alternate between Test1 and Test2. Also the output will alternate between the scripts from each button like so.
This is action 1, Variable value is 0
This is action 2, Variable value is 0
Note that I stopped when the button was in state1 with the label displaying test1
Now in the command line type test = 1
This will change the button color to red as expected. If I had stopped when the text was displaying test2 it would not have untill I clicked the button.
The button state will remain state one and the text will remain Test1.
Changing the variable value to 1 is supposed to change the State of the button as well, but it does not.
Click the button it will output this.
This is action 1, Variable value is 1
The expected output is.
This is action 2, Variable value is 1
Click the button untill the label is Test1
Change the value of @test to 0
test = 0
The button SHOULD have changed to blue, and the text in the button lable will remain Test1. It remains red. As stated above the state of the button must either be the oposite state or the state must change before the color of the button will match the value.
Click the button once. The button will change to state2 the label will change to Test2, the button color will change to Blue and the button will output
This is action 1, Variable value is 0
Click the button multiple times and note that the color of the button remains blue.
To sum it up.
If the variable has the value of 0 the button should be in state1 and be blue.
If the variable has the value of 1 the button should be in state2 and red.
Changing the value of the variable should change both the state of the button and the color of the button.
The button should remain in the state that the variable indicates. Clicking the button in this case should not change the color of the button or the state of the button.
This is not the case so given that. This is what is actually happening
If the button happens to be in state1 and and the value of the variable happens to be 0 the color may actually be red or blue depending on previous actions!!!
If the button is in state1 and the color is red. The value of the variable is 1. Change the variable to 0. Nothing will happen untill you click the button. This will change the button to blue, but the button will be in state2!
If the button is in state2 and the color is blue. The value of the variable is 0. Change it to 1 and nothing happens. Click the button and it will change states and change the color to red but the button will now be in state1!
Ok, So lets pretend we started out with the correct state and the correct color. Best case.
The button is in state1 and it is blue. The value of the variable is 0.
Change the value of the variable to 1 and the button changes color to red.
But the state of the button does not change to State2.
Now change the value of the variable back to 0. Nothing happens untill you click the button; then the color changes back to blue and the button is in state2!
Now for the other best case.
The button is in state2 and it is red. The value of the variable is 1.
Change the value of the variable to 0 and the button changes to blue.
But the state is not changed so you are still in state two and again the button will not change color untill you both change the value of the variable and click the button....
Sorry about the long windedness of this post. Now for the other bug.
If after you created the above toggle button you rename the @test variable to anything else the button will still respond to changes to this variable. This is useful but unexpected behaviour. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Dec 11, 2006 6:38 pm |
I'll take a look at this and see what I can do. If it's an easy fix that I'll put it into the public release.
|
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon Dec 11, 2006 9:42 pm |
Cool. There are just so many pieces to how a button could work. Here's hoping.
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|