jalovatt / scythe

Lua GUI library and utility framework for Reaper scripts (formerly Lokasenna_GUI)
https://jalovatt.github.io/scythe
MIT License
26 stars 5 forks source link

Add a function somewhere to force-focus an element #164

Open jalovatt opened 4 years ago

gwatcha commented 4 years ago
  local finder = GUI.findElementByName("finder")
  window.state.focusedElm = finder

  -- Start the main loop
  GUI.Main()

this snippet worked for me if anyone stumbles on this. it autofocuses an element on window start.

jalovatt commented 3 years ago

Update in case I ever get back to this:

Right now there's no way for an event handler to set the focus, only to lose it. This might just be a matter of:

  -- window.lua @ window:updateInputEvents
  if state.shouldLoseFocus then elementToLoseFocus = state.shouldLoseFocus end
+ if state.elementToFocus then elementToFocus = state.elementToFocus end