Not able to display button status correctly?

I am including a Rackspace with a ScriptLet to demonstrate my questions.

Both Green_Button and Green_Button_Label are Scriptlet parameters. I wish to set them to selected and “DISABLED” respectively. I try to do this in the Initialization Code … which doesn’t seem to fully work. IE: the button stays as is and the label changes but then goes invisible.

So, my questions are:

  1. Initialization - even though I set Green_Button to 0.00000, it still remains enabled or in the selected state, why?

  2. ParameterValueChanged callback- when I set the Green_Button_Label to “ENABLED” or “DISABLED” based on Green_Button’s value, it changes for a moment and then disappears, why?

Plz take a look at the Scriptlet and tell me what I am doing wrong? :slight_smile:

BUTTON display not working.rackspace (36.7 KB)

Apply the changes marked red

Apart from that Replace

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   DIVISI_Button : Widget
   DIVISI_Label : Widget
//$</AutoDeclare>

with

//$<AutoDeclare>
// DO NOT EDIT THIS SECTION MANUALLY
Var
   Button : Widget
   Button_Label : Widget
//$</AutoDeclare>

It causes script errors, but it has nothing to do with your current problem.

I think it gets a script error because “Button” is a reserved word. I changed the name to “Button_Button” and now no script error.

If I set the text label to “Hide Temporary Value” it doesn’t work, unselecting it … now it works!

Try the Rackspace again and tell me if it works on your computer plz?

BUTTON display not working.rackspace (36.7 KB)

You need to adjust the value with literally [value]

Then you can switch ‘hide temporary value’ to on

Although, when you’re happy, please stay that way :grinning:

1 Like

Ahhhh! That’s the trick :slight_smile: Thank you.

Why does that work I wonder? IE" If I leave this field blank, it doesn’t work.

When you leave it blank and you turn ‘customize caption’ off, it will display the parameter it is bound to and temporarily show the value when it changes. When you turn ‘customize caption’ on, you overrides it (except from the temporary value, that’s where hide temporary value comes in). When you leave it blank, it stays blank, because you’ve overridden it. When you enter [value] then the value is displayed (what you wanted). [value] acts like a sort of macro. You can put extra text in the box for instance ‘and the value of my big green button is [value]’

Great explanation Frank, thank you :slight_smile:

Now it’s working… :slight_smile:
I removed the unneeded variable definitions in the rackspace script, then i changed the widget properties (see screenshot) and i chanegd the scriptlet’s code a bit.

I think there is no need for an initialization routine here, since you already initialized the parameters by definition, i also changed the the testing for ==1.0 to >0.6
Before i always had to press the button multiple times until it really behaved as expected… strange.

BUTTON display is working.rackspace (35.0 KB)

Var 

    Green_Button : Parameter  = 0.0
    Green_Button_Label : Parameter "DISABLED ", "ENABLED" = "DISABLED"

On ParameterValueChanged matching Green_Button

//    Print("On ParameterValueChanged matching Green_Button:   "+Green_Button )

    
    if Green_Button > 0.6 then
        Green_Button_Label = "ENABLED"
//        Print("Green_Button_Label = ENABLED: "+Green_Button )
   else
        Green_Button_Label = "DISABLED"
//        Print("Green_Button_Label = DISABLED: "+Green_Button )
    end

end
1 Like

:+1:t2:. So many ways, so little time :grinning:

1 Like

I tried your solution, but I am still experiencing the problem. I must have missed something. Can you take a look at my Rackspace please?

BUTTON display Schamass Method.rackspace (36.7 KB)
?

I think Gig Performer is having problems with my Gig File because if I exit GP and then come back in, the Rackspace works. I will research this further.

Will do… later. :wink:

Try this setting

Can you describe what exactly the issue is, or what exactly is happening and when?

From what i can tell at the moment, you managed to export the rackspace from your last posting in a widget state where the button is OFF but the label is “ENABLED”, which is an exception that shouldn’t exist (GP saves the widgets states as they are and recalls them on load).
This paradoxic widget state can only be created if you switch the button to OFF and then (why ever) manually change the label-parameter to “ENABLED”, which can be done because the script only uses a callback parameter for changes from “Green_Button”… and this isn’t altered at that moment.

So what happens then is the following:
Rackspace is imported with Button = OFF and Label = ON
→ Button = OFF (per variable definition) → no button-parameter change → Label = ON
→ Press the button → button-parameter changes (from 0 to 1) → Label = ON

So the first click will have no effect on the label, since it is already ON.
After that the function will work as expected.

I tried to re-activate the Initialization routine to set the button and the label to OFF when the rackspace is loaded, but strangely this had no effect.
What worked then to have both widgets started in OFF state (if that’s what you want?), was to use the “On Activate” routine to set the parameters to 0
But this would happen every time you switch to that rackspace… don’t know if that’d be ok for your use case.

// Called when rackspace is activated
On Activate
    Green_Button = 0.0
    Green_Button_Label = "DISABLED"
End
1 Like

Thanks for the research :slight_smile:

On activate is definitely not what I want as I use this technique in a much more sophisticated Rackspace. However, your technique works fine now … as I am not sure what I was doing wrong … but in the course of my development and testing, GP has locked up many times. I attribute this to my funky coding. So, thanks for your help, it did solve my problem.

I will be pushing my Rackspace soon for you to check out. It is a highly advanced version of your initial DIVISI design Rackspace. I know you will love it when I get it finished. Thanks for inspiration :slight_smile:

1 Like

Not sure if i actually did that… :thinking: