Send Undo Command from within a plugin
Is there a way to send an "undo" command from within a plugin? I wrote a plugin to add Dulcimer Tab to a score (basically I borrowed code from the great tab creator plugins that already exist). There are a number of different ways to tune a dulcimer, and I allow the user to select a tuning prior to creating the tab. Works fine. If the user then wants to see what the tab looks like in a different tuning, however, the "putStaffText" command just writes the new text over the top of the old text. Which makes it hard to read :)
A simple CTRL-Z is all it takes to undo the previous text, but in the testing I have been doing it appears that people would prefer it to happen automatically.
Does anyone know if there is a way to send the undo command from within the plugin?
If that isn't possible, does anyone know if there is a way to overwrite text with spaces?
Thanks!
Regards,
Keith
Comments
Calling undo from the plugin framework is not possible right now.
If you keep a reference to your Text object you can reset its text or set it to another value, but it's ugly... the text element will remain in the score even if it's empty.
In reply to Calling undo from the plugin by [DELETED] 5
Thanks for the quick reply, lasconic!
I think I have three options:
1. Put some text on the interface that tells the user to press CTRL-Z to reset
2. Create a new score each time (or give the user that option)
3. Keep track of the text object and reset its value each time
The first two are easy, but I think from the user perspective option three probably works the best, so I'll play around with it.
Thanks again!
Keith
In reply to Thanks for the quick reply, by Keith.OpenSource
The first one looks better to me. Ctrl + Z or Edit -> Undo.
In reply to The first one looks better by [DELETED] 5
Thanks Lasconic!
I completely understand your perspective
K