I’m trying to make a modification to the NotesRandomize script.
Basically, when in the script’s GUI I often want to UNDO. To do this, I have to forcibly click between the pattern editor and the script.
I imagine all I need to do, from a scripting point of view, is add CTRL-Z to my keyandler routine and call renoise.song():undo()
But, when trying to find out what I need to capture I run into some very OSX specific debug info.
rprint(key)
[character] => z
[modifiers] => command
[name] => z
So, my questions.
In ActionScript, you can “throw” key captures and mouse events (called event propagation). Is there such a concept in the Renoise API? What I mean here is instead of re-programming UNDO to UNDO (which is redundant) can I, instead, just throw it to the parent which reacts in the default way?
I imagine “command” is not a modifier on Windows or Linux, is there a more generic approach or do I have to “OR” this to be multi-platform?
That was what i was thinking as well… Windows programmers won’t foresee Mac users have a command-key instead of control so this means that shortcuts inside scripts that relay on these keys aren’t portable.
You can also configure shortcuts, so it doesn’t even have to be “Control + Y” for some.
What about passing keys back to Renoise instead. Something like:
function key_handler(dialog, key)
local handled = false
if (key.name == "my_key") then
-- do something, and don't pass the key to Renoise
handled = true
end
-- when not handled, let Renoise do something with the key...
return handled
end