Forum Discussion

Wesley_Struble's avatar
5 years ago

CMF Property Coloring

Hello,

I'm working through the CMF guide, and attempting to implement the task in 4.1.9 (Set the text color for a given zone) for a real world use case.

In my Innovator instance, I have a CMF Item Type called MyPQD, with two properties -- MyStringProp, and MyTextProp. (per an earlier example in the guide)

I'm using the following code, but not having any luck getting the color to change.  Any idea what I'm doing wrong here:

 var color = "#008000";
var innovator = aras.newIOMInnovator();
var myElement = innovator.newItem("MyPQD", "cmf_updateElement");
myElement.setProperty("Text", MyTextProp);

// create cmf style object and set available styles
var cmfStyle = innovator.newItem("cmf_Style");
cmfStyle.setProperty("text_color", color);
myElement.setPropertyAttribute("MyStringProp", "style", cmfStyle.toString());

// you should set value of property directly, otherwise it will be updated to empty value
// for this purpose we need to get existing element with property
var existmyElement = innovator.newItem("MyPQD", "cmf_getElement");
existmyElement = existmyElement.apply();
myElement.setProperty("MyStringProp", existmyElement.getProperty("MyStringProp"));
myElement.apply();


2 Replies

  • Former Member's avatar
    Former Member

    Because the structure of the Color class in WPF supports both approaches.Use either standard RGB properties set  (A, R, G, and B) and a set of scRGB properties (ScA, ScR, ScG, and ScB). These properties are related, so if you set the R property, then the ScR property will change accordingly. This is how the color changes.

    https://writemyessay.onl/write-my-assignment/

  • The structure of the Color class in WPF supports both approaches site. Use either the standard RGB properties set (A, R, G, and B) or the scRGB properties (ScA, ScR, ScG, and ScB).