Quote from
Gaev on October 3, 2021, 7:50 pm
@giasal
When you want to dynamically add style properties/values to an object, use SetObjectCSS e.g. from the Help file ...
CreateEmptyObject [myCSS]
SetVar [myCSS("left")] "+=200"
SetVar [myCSS("top")] "+=100"
SetVar [myCSS("width")] "+=100"
SetVar [myCSS("height")] "+50"
SetObjectCSS "Container1" [myCSS]
When you want to apply a previously defined css class (category) that was defined in your project via Project>>> Properties >>> Styles, like so ...
.creditsButton {
background-color: #EF2447;
border: none;
color: white;
padding: 2px 4px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
margin: 2px 2px;
cursor: pointer;
}
... to be applied to an object, then use AddClass e.g. ...
AddClass "PushButton1" "creditsButton"
Note: do not use the dot prefix in the command; it is used in the css definitions to identify it as a class definition.
@giasal
When you want to dynamically add style properties/values to an object, use SetObjectCSS e.g. from the Help file ...
CreateEmptyObject [myCSS]
SetVar [myCSS("left")] "+=200"
SetVar [myCSS("top")] "+=100"
SetVar [myCSS("width")] "+=100"
SetVar [myCSS("height")] "+50"
SetObjectCSS "Container1" [myCSS]
When you want to apply a previously defined css class (category) that was defined in your project via Project>>> Properties >>> Styles, like so ...
.creditsButton {
background-color: #EF2447;
border: none;
color: white;
padding: 2px 4px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
margin: 2px 2px;
cursor: pointer;
}
... to be applied to an object, then use AddClass e.g. ...
AddClass "PushButton1" "creditsButton"
Note: do not use the dot prefix in the command; it is used in the css definitions to identify it as a class definition.
luishp and GiaSal have reacted to this post.