Can a shortcut be run while textfield is focused in GUI?

Here’s my issue.
I want to be able to open a GUI - highlight a textfield, be able to type into it, and WHILE the textfield is active / in edit_mode, trigger a shortcut.

How would this be done, please?

I can already open a GUI so that the textfield is auto-selected and ready for typing, but i need to, while in the textfield, be able to trigger a shortcut.
currently, if i use enter/return to trigger a shortcut while the dialog is open, i need to press enter twice (once to blur, once to run).
how can i make a textfield only accept numbers and dots, and if anything else is pressed, do something else with them?

Custom shortcuts within custom text fields are currently not supported.

1 Like

ok, i found i had solved this with a workaround

  local vb = renoise.ViewBuilder()
  local initial_value = "0.93524"
  local textfield = vb:textfield{
    width = 60,
    id = "value_textfield",
    value = initial_value,
    edit_mode = true,
    notifier = function(new_value)
      local clamped_value = math.min(math.max(tonumber(new_value) or 0, 0), 1)
      if tostring(clamped_value) ~= initial_value then
        apply_textfield_value_and_close(clamped_value)
      end
    end
  }

seems to work
and one enter will now close the dialog and write the automation value

set automation value dialog

just added this neat little dialog to Paketti.

1 Like

As long you end your input with “Enter” key it should run without problems. The problems starts, when you leave the field during entering process with mouse action or break entering with “ESC” key or doing an Alt-Tab. This is caused from missing of some needed events on the controls for get real safety during input process.

OnKeyDown/Up
OnKeyPress
OnMouseEnter/Leave
OnGetFocused
OnGetFocusLost

Try switch to another application Window during input process where application focus get lost, then do switch back an click again in the input field. It start a new entering process, but the old entering was not abort in a save way. This is very bad behaviour.

happy tracking :slight_smile: