[SOLVED] Overriding Renoise shortcuts while on a lua dialog?

Is it possible to make certain shortcuts available while a LUA dialog is open? i.e. set up specific shortcuts that, while bound to Pattern Editor or Mixer, do those things, but while a LUA dialog is open, then the shortcut does something completely different?

EDIT:
i’m talking about dialog hijacking a shortcut for doing something else.

think “CMD-T in pattern editor creates a new track” → “CMD-T while dialog is open, runs a function in the dialog, presses a button in the dialog, and does not leak CMD-T to pattern editor to create a new track”.

Not sure I get what you want exactly but in general just supply a keyhandler function when creating your dialog, then you can react to any key event while your dialog is open and focused.

local my_handler = function(dialog, key_event) 
  -- check whatever shortcut you want here and do stuff
  rprint(key_event)
end

renoise.app():show_custom_dialog("my dialog", my_view, my_handler)

It doesn’t matter if the shortcut you react to is also bound to something in Renoise as the context is your dialog at that time so other actions won’t be executed.

If you mean the shortcuts themselves are also your tool actions and you want to react to the same shortcuts in the dialog then you’d have to read the user’s keybinding and figure out what key combination they’ve set up and check that.

1 Like

what i’m saying is, let’s say i have CMD-D for duplicating a track in mixer.
but i wanna be in mixer, and have dialog open, and while dialog is open, CMD-D presses a button in the dialog instead of duplicating track in mixer.

sorry for not providing a better example in the original post!

EDIT: is it not possible to have dialog open and not focused, and catch the shortcut? is it always “needs focus”?

Yes, the dialog needs focus, otherwise there is no way to catch keys.

You can have your own keybinding of course and have it do something else based on the visibility of the dialog but that’s probably not what you want.

1 Like

thanks! i’ll have to see if i can make this a preference, i.e. “eSpeak Dialog Shortcut = True” → handler listens for ESC, and a couple of other shortcuts and does stuff" or “eSpeak Dialog Shortcut = False” → handler does not listen for them.

thanks, i got it working. it was pretty easy in the end, not complex at all…

here’s a little example

function PakettieSpeakKeyHandlerFunc(dialog, key)
if key.modifiers == "control" and key.name == "r" then
// DO THAT
end

if key.modifiers == "control" and key.name == "return" then
// DO THIS
end

if key.modifiers == "alt" and key.name == "return" then
// ALSO DO THIS
end

local closer = preferences.pakettiDialogClose.value
print (closer)
  if key.modifiers == "" and key.name == closer then
    dialog:close()
    dialog = nil
  else
    return key
  end
end

thanks @unless

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.