I know I’m most likely doing something stupid but I was playing with my controls a little bit today and stumbled on an issue I can’t figure out. Attached the recording. I can’t figure out focusable on text-field. I see it’s working in humble-ui demo, but I have no idea what am I doing wrong. I tested with regular text-fields instead of customized and getting the same result.
This is how I include sidebar block from the main:
...
(ui/dynamic _ [current-name @state/*chapter
sidebar (when (= current-name name) (get-in chapters [name :sidebar]))]
(if sidebar
sidebar
(ui/gap 0 0)))
...
and chapter’s sidebard code:
(def ui
(ui/with-scale scale
(let [padding-inner 12
fill-bg (paint/fill 0xFFFFFFFF)
stroke-bg (paint/stroke 0xFFE0E0E0 (* 0.5 scale))]
(ui/valign 0
(ui/rect fill-bg
(ui/rect stroke-bg
(ui/padding padding-inner 0
(ui/column
(sidebar/control-group "Ray Position:")
(ui/row
[:stretch 0.4 (xui/number-field {:label "Z"} state/*z)]
(ui/gap padding-inner 0)
[:stretch 0.4 (xui/number-field {:label "Y"} state/*y)])
;; tested with standard text-field
#_(ui/row
[:stretch 0.4 (ui/text-field state/*z')]
(ui/gap padding-inner 0)
[:stretch 0.4 (ui/text-field state/*y')])
sidebar/delimiter
(sidebar/slider "Angle:" state/*angle :suffix "°")
sidebar/delimiter
(ui/gap 0 padding-inner)))))))))
Might just be a bug, focusable is not very good yet
One thing to try: put focus-controller over everything
I was meaning to make it automatic eventually but right now you have to do it manually
Will test in a bit thank you
focus-controller did the trick.