plugin: How to set the (Sub)style "USER1" to an Element

• Jan 12, 2021 - 15:08

i would like to create an Element with type "USER1" or change the type of an STAFF_TEXT Element to USER1.
How can i do this?

i create a Staff_Text by
var itext = newElement (Element.STAFF_TEXT);
this works, but
var itext = newElement (Tid.USER1);
results in an element of type "instrument-change".


I can't answer for details of the plugin framework, but I can tell you about the underlying data structures.
USER1 and the other text styles are not element types, but merely styles that can be applied to element types. First you need to decide on the actual element type you want. If you want a staff text, then create a staff text. Then you just need to figure out how to change its style properties. I realize that's what you started out asking, so I guess I'm just confirming that is the way to go. But also, realize a text style is really nothing more than a convenient handle for a bunch of individual properties like font face, size, offset, alignment, etc. So you could also just change those properties directly.

Do you still have an unanswered question? Please log in first to post your question.