Process flow activity background color change

Process flow activity background color change

pasichp
Not applicable
34 Views
2 Replies
Message 1 of 3

Process flow activity background color change

pasichp
Not applicable

[ FlexSim 23.2.1 ]

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?
0 Likes
Accepted solutions (1)
35 Views
2 Replies
Replies (2)
Message 2 of 3

moehlmann_fe
Explorer
Explorer
Accepted solution

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.

0 Likes
Message 3 of 3

pasichp
Not applicable

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