Can't use onScoreStateChanged
Hello,
I'm trying to use a basic listener/event in my main PluginAPI class named Musescore but I can't even execute cause of : "ligne 20: Cannot assign to non-existent property "onScoreStateChanged""
But on the Doxygen documentation, every PluginAPI object seems to have this property.
And also, the code I'm trying is the basic "selectionChangeExample" plugin...
I'm not a QML/Qt pro, so please someone can help me ? Here is the code :
import QtQuick 2.0
import MuseScore 3.0
MuseScore {
menuPath: "Plugins.selectionChangeExample"
pluginType: "dock"
dockArea: "left"
implicitHeight: 75 // necessary for dock widget to appear with nonzero height
implicitWidth: 150
Text {
// A label which will display pitch of the currently selected note
id: pitchLabel
anchors.fill: parent
}
onRun: {
console.log(this);
console.log(Object.keys(this));
}
curScore.onScoreStateChanged: {
if (state.selectionChanged) {
var el = curScore ? curScore.selection.elements[0] : null;
if (el && el.type == Element.NOTE)
pitchLabel.text = el.pitch;
else
pitchLabel.text = "no note selected";
}
}
}
Comments
Are you trying this in the 3.3-release candidate or the current stable version (3.2.3) ?
This feature is only available from 3.3+. The release is scheduled for tomorrow, but the documentation has already been updated in anticipation of it.
In reply to Are you trying this in the 3… by jeetee
I was trying on the stable version. I thought it was for all 3.x because nothing was speficied in the documentation. I was beginning to be crasy... Thanks for all !
In reply to I was trying on the stable… by Zachary Labaysse
Actually properties and functions documentation is accompanied with something like "Since MuseScore 3.3" where it is appropriate. For example,
onScoreStateChanged
documentation has such entry at the bottom of this handler's description.Anyway, MuseScore 3.3 has been released recently so you may want to try this out in the newly released version.