remove staff text with plugin

• Jan 26, 2019 - 01:24


I have been searching the forum for the correct syntax to remove staff text.

This is how to find them:

for (var n = 0; n < segment.annotations.length; n++) {
  var annotation = segment.annotations[n]
  if (annotation.type === Element.STAFF_TEXT) {
    // check position of element. if x-pos. far off from tickm then ignore
    if ( annotation.textStyleType === TextStyleType.STAFF || 
         annotation.textStyleType === TextStyleType.FINGERING) {
      if (Math.abs(annotation.pos.x) < 1.0) {
        console.log("=> ... HURRAY ... normal staff text found: (" + annotation.text + ") at segment:" + segment.tick + ", position:" + annotation.pos.x)

Can anybody help with the correct syntax to delete a text? I tried several combinations like for example:


(Where n comes from one of the staff texts found from above)

Whatever combination I try, the error I get is that "remove" is either undefined or (obviously) not a function.

For notes the syntax is given here: or here:
Can someone confirm that the answer is provided here: (...In libmscore/segment.h, we could expose the function removeAnnotation(Element* e) ...Sure not for any 2.x version as there won't be further updates, so if any, then for 3.0..)

Reason for this question is that currently the Fix Fingering plugin does not handle staff fingering text and I am trying to implement functionality that staff fingering text is automatically converted to note.elements (Element.FINGERING) text.

Many thanks in advance for any help.

Marc Nijdam


seems to work for me in MS3
var annotation = segment.annotations[aCount];
var stafftext = annotation;

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