Fork me on GitHub

How might one manage dynamic resizing of controls with cljfx? I see various JavaFX examples using bind which I don't think is exposed, but are width/height properties magically wrapped in event handlers somehow? I would happily use a border pane or similar, but ideally I'd be able to spot changes in a parent container's dimensions and use those to scale JavaFX shapes, which aren't resizeable like other controls.


hmm, it looks like you will need to create an extra-props lifecycle (`make-ext-with-props`) that will add on-width-changed/on-height-changed event listeners to your containers


something along the lines of (fx/make-ext-with-props {:on-width-changed (fx.prop/make (fx.mutator/property-change-listener #(.widthProperty %)) fx.lifecycle/change-listener) ...})


nice, will dig into that. ta!


ah, good example in e34_web_browser.clj which I missed, apologies. This method works though, thanks!


This worked out really nicely btw, even ended up using the sub-ctx stuff to subscribe to the changing width/height and work out the aspect fit for another component. Thanks for the pointers!

👍 2