Changing the properties of a widget through GPscript

I have created a text label widget:
image

and gave it a GpScriptName of “D101”.
image

How can I reference and change these properties using GpScript?

Simplest thing to use it:

  • open the script editor
  • right-click to get the popup menu
  • click “auto-declare”

Then you’ll get a declaration for the plugin block

  • right-click again in the script editor somewhere between functions (meaning not in the body of a function)
  • select the plugin/widget sub menu
  • select the plugin event

This will create an empty function. At the end of the first line there’s a dummy plugin reference. Replace that with the name of your plugin block (same as the declaration. In your case D101)

For all available functions: in the help menu of the main GP window there’s a reference to the scripting manual and the function list

Frank,

We are talking about two different things. :slight_smile: First of all I am talking about widgets, not plugin blocks. EG: D101 is the GPScript Name of a widget which in this case, has a caption of “My Text Label”.

I am asking for the Function Name, GP-script code, or the syntax for the code to access and modify the properties of a widget … explicitly: Font Size, Fill Color, Outline Color, Text Color, Thickness, and Roundness. I can’t find any GP Script function or CallBack that will allow me access to those properties.

When checking the functions in the manual, I expected to find something like: “i = GetWidgetProperty.FontSize” or “MyString = GetWidgetProperty(Fontsize)” or “MyString = GetWidgetFontsize()”… but there is nothing like that in the manual.

Phil

You’re right: I mixed that up, but the same principle applies. But D101 is not the script name: it’s the name the widget has in the script of the current rackspace (or global rackspace). You might think of it as an ID or handle (for plugins it’s actually called a handle).

afbeelding

afbeelding

afbeelding

Of course, for a widget you don’t use the plugin event callback, but the widget callback:

But that’s not going to be useful, because you can’t control with a label, so as an example I’ll add a knob:

afbeelding

afbeelding

Don’t forget to press compile. Now you can see the values in the log window:

All available functions:

(GP Script System Functions) → https://gigperformer.com/docs_4_8/SystemFunctionList.html

Or press this button on top of the script editor:

afbeelding

You can’t find the font functions because they’re not available (to my knowledge). Not everything is possible with scripting when it comes to eye-candy: It’s foremost a tool to get the sound you want by manipulating (also conditionally) plugin parameters and processing midi when the normal way (widget → plugin) is not sufficient.

You can however change label colors:
afbeelding

(the effect of this code is rather horrible, but you’ll get the idea).

Hope this helps.

3 Likes

LOL! Now we are talking about the same thing and it does help - thank you for jumping in a helping me! … Our nomenclature is a little different. I did say, “D101 is the GPScript Name of a widget”. I didn’t say D101 is a Script Name. That’s OK, because we are both talking about the same thing.

You have uncovered my real problem. I was looking at the wrong GP Script documentation!!! I was looking at: List of Functions — GPScript 4.1 documentation

If this documentation is obsolete, I wish someone on the GP team would remove it from the web - Please :slight_smile:

As far as understanding the principles of what you are talking about here, I am totally on board with the coding. LOL!


I am working on a new concept for a rackspace which I am building such that GP Users can more easily program a Yamaha TX816. It is not for live use, but highly useful for TX816 users. I am halfway done with it and should have it finished in about two weeks (after I test the hell out of it). It is perfect for the person who wants to program all 8 TF1 modules in a virtual TX816 (using 8 DEXEDs simultaneously). BTW, the DEXED plugin sounds really phatt when using U-he’s Presswork set at “Pillow Yum”

Right now, it takes 2 - 4Unit panels as you will see in the attached pic. My code works well as it lets you load your selected GPPreset for each DEXED and then lets you select the patch.

The second panel lets you control which DEXED modules you want active using radio buttons and which DEXED module’s Plugin Editor you want to open and close. Of course, there are mixer controls for each module, so when you change variations the volume, panning, and bypass will be as you like them.

The first panel works flawlessly, but right now has to display the selected patch in a single Text Label Widget. What I want to do is highlight the specific Text Label widget’s Fill Color, Text Color etc. to let the user know that it is selected as the user moves the slider in each DEXED module. I have to add a slider for each DEXED module which will allow the user to specify the Cartridge (.syx file) he wants to use for the Module. With a little luck, I will have that done this weekend for all 8 modules. In case you are not aware, there are at least 300 cartridges programmed by pros since 1983. Each cartridge consists of 32 patches. Believe it or not, 10% of them are spectacular - as I have found out using my TX816 Rackspace. Now, when you extrapolate that across 8 TF1 modules (DEXED) that sound is super-powerful and deeeeeep with harmonics. Yum!

If and when I get this done, I am going to do the same rackspace concept with Sonic Projects OP-X3!

If you or anyone in the scripting group want to take a look at my code, I will gladly post it.

Thanks again for your help. :slight_smile:

Phil

P.S. If David is watching this post, please give me a “SaveGPPreset Function”.

1 Like

There could be users still using 4.1. Not that I would advise that, but hey… :grinning:

The right documentation for each version is available through the help menu anyway (although I have to admit that I tend to search
the documentation using Google and then also end up with the older docs :shushing_face:)

The SetWidgetFillColor function requires an Integer. I have no idea what it wants. So I coded it as:

SetWidgetFillColor(D101, 16711935) //Green = 00FF00FF = 16711935

… and of course, it gave me a lavender color instead of Green. Any ideas or solution?

image

Use RGBToColor(r,g,b,a)

Yep.

SetWidgetFillColor(D101, RGBToColor(1.0,0.0,0.0,1.0)

is red. I understand now that 1.0 = FFhex and 0.0 = 00hex.

How would you express this shade of blue?

image

r = 0.0 … 1.0 (red)
g = 0.0 … 1.0 (green)
b = 0.0 … 1.0 (blue)
a = 0.0 … 1.0 (alpha == opaqueness)

Mixing gives other colors.
You can use the values from the color-chooser and divide them by 255.0

What i do to get the RGB integer is as follows:
Create a shape widget, set it to the desired color manually, then give it a script handle xyz and use
Print(GetWidgetFillColor(xyz)) to have the matching integer printed out to the log window, from where i copy that value and use it as a constant in the header of the script.

3 Likes

Brilliant schamass! I deleted my previous post because although I said the exact same thing, I thought the post wasn’t replying directly to you.

BTW, when you write GP SCript, which Editor do you use?

1 Like

I use the inbuilt. It’s not ideal, but it’s always there and there are no additional workarounds needed like using includes (which make gig files less self-contained) or copy and paste from one editor to another.

But someone wrote a package for visual studio code:

1 Like

It’s even easier that. Do this:

var
Background : widget
BackgroundColor : Integer = GetWidgetFillColor(Background)

1 Like