question

Przemyslaw Pasich avatar image
0 Likes"
Przemyslaw Pasich asked Przemyslaw Pasich commented

Process flow activity background color change

I would like to change the background color of an activity (as you can do using the color picker per screenshot) using FlexScript.cameleon-color-picker.png

As far as I noticed, the color picker modifies the values under the subnodes of the activity treenode under:

.find(">visual/color")

address. However, when I change these values using:

.subnodes[1].value = 0.8

these changes are not observed immediately. To see the effect, you need to close the window of the process flow and re-open it. That suggests I'm missing some kind of repaint/redraw instruction. Could you please suggest what the missing lines of code are?:

treenode cameleon = getactivity("ProcessFlow", "Cameleon");
treenode colornode = cameleon.find(">visual/color");
colornode.subnodes[1].value = 0.8;
colornode.subnodes[2].value = 0.8;
colornode.subnodes[3].value = 0.8;
// how do I "refresh" Process Flow window to observe these changes to color?
FlexSim 23.2.1
process flowflexscripttreeactivity appearance
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Przemyslaw Pasich commented

You have to run.

function_s(processFlow, "rebuildBrushes", activity);

A good approach to find commands like this, I have found, is to inspect the code behing the GUIs. In this case you would start by "exploring" the structure of the activity's properties panel.

1698143834228.png

In its tree, you can find the path under which you find the popup that gets created when you click on the "EditFont" button.

1698144055827.png

Navigating there, you can find the code that gets fired when the "Apply to Block Type" button is pressed. (Other GUI elements would probably lead to the same goal, but this was the first one that looked promising to me). In the code, you can then look for functions that sound like they might be what you are looking for and test them through the script console (in some test model of course).

1698144168425.png

Disclaimer: "function_s()" is only intended for use by the developers. Using it yourself is fine mostly, but forward-/backward-compatibility is not guaranteed.

Disclaimer 2: This method of scouring GUI code for answers can work, but sometimes you also end up at a dead end because functions are defined in a DLL and not directly accessible.


1698143834228.png (36.6 KiB)
1698144055827.png (36.1 KiB)
1698144168425.png (101.0 KiB)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Przemyslaw Pasich avatar image Przemyslaw Pasich commented ·

Hi Felix, brilliant - exactly the thing I was looking for! And thanks a lot for the tip on how to do these deeper-level investigations into the code. It will definitely come in handy later on!

0 Likes 0 ·