Is there a way to dynamically show/hide tabs and score for a specific track (or even all tracks)? #1768
-
I found in the docs that using alphatex this works well using Is it possible to dynamically change this when for example loading from a const onRenderFinished = () => {
for (const track of api.tracks) {
for (const staff of track.staves) {
// hide tab, show notation
staff.showTablature = false
staff.showStandardNotation = true
}
}
api.renderFinished.off(onRenderFinished)
}
api.renderFinished.on(onRenderFinished) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You're almost on the right track. Changing the song model to specify which staves to show is correct. But the modification has to happen before the rendering. You can either hook into the After the modification you can relayout and redraw the music notation with |
Beta Was this translation helpful? Give feedback.
You're almost on the right track. Changing the song model to specify which staves to show is correct. But the modification has to happen before the rendering.
You can either hook into the
scoreLoaded
event or simply access at any time (e.g. as part of UI interactions) thescore
and/ortracks
to do modifications. But at this point they just change the model, but there are not active listeners for any kind of modifications so you have to manually initiate an update.After the modification you can relayout and redraw the music notation with
render