bind functionality
rutenkolk opened this issue · comments
Support Question
Hello there, first of all, thank you for this wonderful library.
I've been using it instead of regular javafx for the fast few while and I really enjoy using it. However I have encountered a few roadblocks.
What would be the correct way to emulate the infamous "fit-to-parent" AnchorPane functionality? My so far unsuccessful approach was something like this:
(controls/anchor-pane
:children
[(controls/some-control
:anchor-pane/top-anchor 0.0
:anchor-pane/bottom-anchor 0.0
:anchor-pane/left-anchor 0.0
:anchor-pane/right-anchor 0.0)])
But for some controls (ImageView cough) I know, this just won't cut it in the long run. So are there major hurdles for the nested-properties branch to get merged? I looked at the source and am looking forward to the :bind/property syntax with [:id :prop] values. I don't really get the complete picture of what is depending on what right now, but with some pointers I would like to look into this and help if possible/necessary.
Wow I was totally on the wrong track about the AnchorPane. The above approach works as expected. I just messed up the camel->kabob in my head.
Everything was wrapped inside an HBox and if you want to call the parents
HBox.SetHgrow
method, the correct keyword-value-combo to use here is:
(controls/anchor-pane
:h-box/hgrow javafx.scene.layout.Priority/ALWAYS
:children [...]
)
instead of my initial :h-box/h-grow
The bind implementation is slightly hacky, and could be improved, but the real reason is that wanted to look whether a different API would be better. I'm not very happy with the dot notation, but otherwise have no better idea :) . A treeview for example looks like this:
(ui/tree-view
:id :my-tree
:listen/selection-model.selected-item {
:event :node-selected
:fn-fx/include {:my-tree [:selection-model.selected-item.value]}})
You can use the branch nested_properties and let me know if you encounter problems. It has everything master has.