Change LED widget color based on status

Sorry Ver 4.0.54,

Yes, right, sorry, this is the code

On WidgetValueChanged(newValue : double) from OnOff1
    SetWidgetFillColor(Shape1,0.8, 0.2, 0.2, 1.0)
End

The latest official version is 4.5.8, from one year ago (June 2022) — why are you running 4.0.54?

I assume you declared the widget handle correctly…
Besides the antique version, according to the functionslist manual (and also the code helper):

…the color value must be of integer type! A usable “color-integer” value would be i.e. this : -2697522

If you want to use RGB-values as double type, you will have to convert them first to a usable integer
You can do that with

If you combine both functions then the whole term would be like

On WidgetValueChanged(newValue : double) from OnOff1
    SetWidgetFillColor(Shape1,RGBToColor(0.8, 0.2, 0.2, 1.0))
End

Hope this helps… and please do yourself a favour and update the program!

1 Like

Ha ha ha!!!

1 Like

Money

What about it? Anybody who bought a gp4 license is entitled to a free update to 4.5

Thank you very much schamass, now I have a problem in RGBToColor it indicates “Argument type mismatch”

I was using Mainstange and I’m going back to Gig Performer

1 Like

Please post the whole code and not only a snippet… will make things easier!

Ok, but if you have bought a GP4 license, then you are entitled to use GP 4.5.8, so why are you still running 4.0?

Var
MidiOut_Ipad : MidiOutBlock
MidiOut_Kurzweil : MidiOutBlock
MidiOut_Motif : MidiOutBlock
MidiOut_SonicCells : MidiOutBlock

MidiIn_Kurzweil     : MidiInBlock
MidiIn_StudiologicL : MidiInBlock
MidiIn_StudiologicR : MidiInBlock

IpadVol             : Widget
KurzweilVol         : Widget
MotifVol            : Widget
SonicCellsVol       : Widget

Shape1, Shape2, Shape3, Shape4, Shape5, Shape6 : Widget
OnOff1, OnOff2, OnOff3, OnOff4, OnOff5, OnOff6 : Widget        
Barra1, Barra2, Barra3, Barra4, Barra5, Barra6, Barra7, Barra8, Barra9  : Widget

Vibrato             : widget

// Selecciona separacion del Vibrato

Function RGBToColor(red : double, green : double, blue : double, alpha : double) 
End

Function SetWidgetFillColor (w : Widget, color : Integer)
End

On WidgetValueChanged(newValue : double) from OnOff1
    SetWidgetFillColor(Shape1, RGBToColor(0.8, 0.2, 0.2, 1.0))
End

Just delete these lines… this was part of the documentary.

1 Like

Oh and be aware of the fact that switching the widget off will also trigger this callback (it’s also a value change!)
Use the newValue to test for on or off state of the widget.

If I delete it, I go back to the problem at the beginning where it doesn’t recognize me SetWidgetFillColor = “Unknown identifier: SetWidgetFillColor”

I also would like to know… :nerd_face:

That function was added in GP 4.5

OK, and in previous versions, what is the function ?

Huh? That function was added in GP 4.5 - it did not exist in previous versions.

Then you might have typed something wrong, or… you’d have to update to V4.58!
Just download and install it! It’s there and it’s free for anyone who has a valid GP4 license

Here is a sample gig file which worked on my GP 4.5.8 on the first run without any errors

Where did you get your copy of Gig Performer from?
Is it the original Deskew or the PA edition (if the latter: locked/unlocked)?

shapecolor.gig (36.3 KB)

Var
Shape1 : Widget
OnOff1 : Widget        

On WidgetValueChanged(newValue : double) from OnOff1
    If newValue >0.6 then
        SetWidgetFillColor(Shape1, RGBToColor(0.8, 0.2, 0.2, 1.0))
    else
        SetWidgetFillColor(Shape1, RGBToColor(0.8, 0.2, 0.2, 0.0))
    end
End
1 Like