Fork me on GitHub
#cljfx
<
2021-01-02
>
cjmurphy00:01:03

Can anyone confirm whether e26-tooltips works (or does not)? For me it doesn't. I get a big black circle but waving the mouse across it has no effect. What should happen is you see a tooltip that tells you the radius of the circle. I'm using JDK 12.0.1 and the "RELEASE" version of cljfx.

raaon04:01:54

@cjmurphy i verified it works for me on the latest cljfx master ... i verified with JDK 11 and 12 on mac os (once i hover, it takes 1-2 seconds for the tooltip to show) hope this helps

cjmurphy04:01:18

Thank you @atdixon. Yes works for me too I just wasn't being patient enough with holding the mouse still for a good period of time.

🙂 3
👍 3
raaon19:01:51

looking for advice i have a :label that is swapped for :text-field when clicked and i'd like .requestFocus on the :text-field after it is added i've tried ext-on-instance-lifecycle adding a .sceneProperty listener (requesting focus when scene is set on the new text-field), but the scene is updated on other rendering operations so the text-field will re-request focus at inopportune times am wondering if there is a more direct way to achieve this

raaon19:01:05

follow up - if i have the listener remove itself after its first firing then this approach seems to work but :on-created doesn't get invoked when i have an :fx/key

raaon19:01:29

but perhaps there's a better way to do focus management ...

vlaaad19:01:18

@atdixon can you show your composition of :fx/key with ext-on-instance-lifecycle?

vlaaad19:01:34

wild guess: you might need :on-advanced too

raaon21:01:55

@vlaaad thanks! on-advanced worked really well

👍 3
raaon21:01:27

this is roughly the code:

(defn task-row [{:tasks/keys [id name]} editing-id]
  (if (= id editing-id)
    {:fx/type fx/ext-on-instance-lifecycle
     :fx/key id
     :on-advanced #(let [listener
                         (reify ChangeListener
                           (changed [me _ _ v]
                             (doto ^TextField %2
                               .requestFocus
                               .end
                               (-> .sceneProperty
                                 (.removeListener me)))))]
                     (-> ^TextField %2 .sceneProperty
                       (.addListener listener)))
     :desc {:fx/type :text-field
            :text name}}
    {:fx/type fx/ext-on-instance-lifecycle
     :fx/key id
     :on-advanced #(let [listener
                         (reify ChangeListener
                           (changed [me _ _ v]
                             (doto ^Label %2
                               .requestFocus
                               (-> .sceneProperty
                                 (.removeListener me)))))]
                     (-> ^Label %2 .sceneProperty
                       (.addListener listener)))
     :desc {:fx/type :label
            :text name
            :focus-traversable true}}))

raaon21:01:41

i'm only using on-advanced...

raaon21:01:03

on the first creation of the "task row" there's no need to request focus

raaon21:01:26

but when the row goes into editing the :`label` is swapped for :text-field

raaon21:01:01

when the :text-field is swapped back, the same technique is used to keep focus on the :label

raaon21:01:10

...not sure if there's a better way to do this, or if there is danger lurking here 🙂