scythe icon indicating copy to clipboard operation
scythe copied to clipboard

Add a function somewhere to force-focus an element

Open jalovatt opened this issue 5 years ago • 2 comments

jalovatt avatar Feb 09 '20 19:02 jalovatt

  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.

gwatcha avatar Jul 31 '20 00:07 gwatcha

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

jalovatt avatar Oct 05 '20 00:10 jalovatt