it is just a red pane, when you click on it changes it's translate-x and width, but only the :on-layout-bounds-changed listener is firing
no idea why the rest of them aren't
oh, I might know why š
Thatās probably because the change events are fired during the update, and no event listeners are notified during the update
Take a look at this example:
{:fx/type :text-field
:on-text-changed prn
:text "hello world"}
When text field node is being created from this description, cljfx will set text change listener on it, and also it will set the text. But you donāt really want to receive notifications about changes to a text when itās initially set to āhello worldā, so I made a decision to not execute any listeners while update is in place. Why would you want to receive notification that paneās translate-x is set to 300, when you already know in your event handler that itās set to 300?With that said, Iām not sure how I feel about that decision. I remember it gave me some troubles a couple of times.
You can try wrapping your pane in this extension lifecycle:
(def ext-with-advance-events
"Extension lifecycle that notifies all listeners even during advancing
Expected keys:
- `:desc` (required) - description of underlying component"
(reify fx.lifecycle/Lifecycle
(create [_ {:keys [desc]} opts]
(binding [fx.lifecycle/*in-progress?* false]
(fx.lifecycle/create fx.lifecycle/dynamic desc opts)))
(advance [_ component {:keys [desc]} opts]
(binding [fx.lifecycle/*in-progress?* false]
(fx.lifecycle/advance fx.lifecycle/dynamic component desc opts)))
(delete [_ component opts]
(binding [fx.lifecycle/*in-progress?* false]
(fx.lifecycle/delete fx.lifecycle/dynamic component opts)))))
I'm not super sure I need it for this case since it is a minimal example, but was trying to understand the listeners What I'm trying to do is draw a pane with some other panes inside, when the pane is dragged or resized I would like to get the positions of the panes inside, since they are calculated by the layout system (not fixed)
it would also useful if you need to do something when a node position change, in the example above I know what is the position but I don't have a way to do something when the position changes
wrapping it in that lifecycle worked, will use that, thanks !!!
you are welcome š
it would be useful to also have a reference to the object when a property change fires soy you can check lets say childs layouts when parent is resized etc
yeah.. I found custom layouts hard to do in cljfx š
I'm using cljfx for "not the normal stuff" and so far I'm pretty happy with it :simple_smile:
maybe adding those little things enable more use cases