What's the recommended way to assign initial values to global widgets?

I’m using GP 4.5.8. I’m aware that the “initial value on gig load” options under the Value tab in the widget editor are not available for widgets in the Global Rackspace, and I’m finding this limitation to be frustrating.

I suppose it’s not a bug per se, because it is clearly documented, but I can’t figure out a reason why this should be the case.

What’s the recommended workaround? Do I need to explicitly set Global Rackspace widgets to their default values in the Initialization section of the global rackspace script? My global rackspace script is already quite bloated, and if I need to keep an array of all of the global widgets which need to start at particular values and then remember to add new widgets to that array in the future, it just seems like… there must be a better way.

Suggestions?

Solomon

P.S. I have read this thread, and it doesn’t offer a simpler workaround than the one I’ve come up with, so maybe my kludgy plan is in fact the simplest: Initial Value of Global Widget

You can create an “initial” rackspace as the first rackspace and have a local widget there, with an “On Load” value set. Then map that widget to the global widget.

Link: How to control widgets from the Global rackspace in a regular rackspace?

Then, when the gig is loaded, that rackspace will be the first one to open and will set the global rackspace widgets.

Just make sure the “open to the last active rackspace” option is not checked in the Options.

Alternatively, scripting can be used.

I’m trying to do this with scripting (since global parameters are a precious resource for me) and I’m finding it trickier than I expected.

I’ve reset the widgets to their default values in the Initialization block of my global rackspace script, but I’m finding that after I do so, GP then sets them to their values on last save, undoing my efforts.

Thinking that maybe the global rackspace is activated after the Initialization block is executed, and that maybe the widgets are set to their last-saved values on activation, I tried using on “On Activate” block instead, but apparently this is not allowed in the global rackspace script.

My forehead is gathering bruises from hitting it against this brick wall. :slight_smile:

Solomon

I figured it out: whenever GP sets the widgets to their last saved values, the widget callback will be invoked, so that’s the correct time for us to reset them. Here’s the relevant code in my global rackspace script:

var IEMWidgets : Widget Array = [
   IEMAviom, IEMKeys, IEMTalkback, IEMVocal, IEMClick
]

var IEMWidgetsNeedResetting : Boolean Array = [
   true, true, true, true, true
]

// reset these global-rackspace widgets to default values, but only when GP tries to
// thwart us by setting them to previously saved values

On WidgetValueChanged (w : Widget, index : Integer, newValue : Double)
    from IEMAviom, IEMKeys, IEMTalkback, IEMVocal, IEMClick
  If IEMWidgetsNeedResetting[index] Then
    ResetWidgetValue(w)
    IEMWidgetsNeedResetting[index] = false
  End
End

(In my case, the widgets are mixer faders that control the mix in my in-ear monitors, which is why they’re named as they are here, but of course one would use whatever widgets apply in a given situation.)

I’ll also post this solution in the other thread in case anyone else is searching for this workaround.

Solomon

1 Like

Your script is excellent. I’m applying it right now to my latest Gigs.

I see that this calls ResetWidgetValue(w), but there is no way to set the default for a Widget in the Global Rackspace. Wouldn’t is be better to call SetWidgetValue and to provide it a script-specified default value?

var
myDefault : Double := 0.123456 // …or whatever

SetWidgetValue(w, myDefault)

Your code might work today if the default value of a generic Widget aligns with what you want, but if that generic default changes in the future, the new default might not be what you want.

Again, thanks for the excellent script example.

You can specify the default you want for each widget in the widget properties.

Ahh. I see. I’m working with buttons. Sliders have a default value, but buttons do not have any default value or initial value available in the Panel Edit | Value window.

So for sliders, it might depend on personal preference. By including it in the script, you can look at one item to see that all of the defaults are set properly. By using the value in Panel Edit | Value, you would need to click on each Widget. For some, Scripts are out of sight and out of mind, so using the UI would be best. For script-first users, it’s nice to look in one location to see that all of the values have the desired default.

I think that for buttons, the script is the way to go, unless you link it to a button in a Local Rackspace.