cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Style definition using scripts

svisveswaraiya
17-Peridot

Style definition using scripts

Hi,

1) chart.png1.png2.pngI saw a thread in community and tried to create style definition using script and when I run it, it doesnt show any output. What should be the base type to create a style definition?

var name = "NewTestStyle3";
try{
    Resources["EntityServices"].CreateStyleDefinition({
        name: name,
        description: undefined ,
        content: { "content" : 
                  {   "params": "",
                       "image":"",
                       "backgroundColor":"#d49d13",
                       "textSize":"normal",
                       "lineStyle":"dotted",
                       "displayString":"Series 15",
                       "fontEmphasisUnderline":false,
                       "fontEmphasisItalic":false,
                       "lineThickness":1,
                       "lineColor":"#ffac20",
                       "foregroundColor":"#ffdc84",
                       "fontEmphasisBold":false,
                       "secondaryBackgroundColor":"#ffb22f"
                  
                  }
                 },
        tags: undefined 
    });


}catch(err) {
    logger.error("EERROR STYLE CREATION "+err);
    Resources["EntityServices"].DeleteStyleDefinition({
        name: name
    });
}

2)  I am using a colour picker widget downloaded from market place where the selected colour appears like a code. How can I bind the output of the selected colour from colour picker to the style definition?

1 ACCEPTED SOLUTION

Accepted Solutions
gbucur
5-Regular Member
(To:svisveswaraiya)

Hi,

 

I believe the goal here is to make some kind of theming?

If so, you can do it with CSS and TWX 8.3 and above.

 

To generate that CSS, a some of the widgets have been created by me in CSS Widget Configurator. With this you can basically bypass StyleDefinitions.

With this you can have different CSS files locally and append them to the header with jQuery based on some user preference with the expression widget.

 

Let me know if this helps in any way :)

View solution in original post

2 REPLIES 2

Could you please clarify what you mean by base type? You don't need to set anything to output, if that's what you are asking. The result still be listed in the style definitions.
As for the marketplace extension, I believe it's not supported anymore.
gbucur
5-Regular Member
(To:svisveswaraiya)

Hi,

 

I believe the goal here is to make some kind of theming?

If so, you can do it with CSS and TWX 8.3 and above.

 

To generate that CSS, a some of the widgets have been created by me in CSS Widget Configurator. With this you can basically bypass StyleDefinitions.

With this you can have different CSS files locally and append them to the header with jQuery based on some user preference with the expression widget.

 

Let me know if this helps in any way :)

Top Tags