Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bind functionality #84

Open
rutenkolk opened this issue May 10, 2019 · 2 comments
Open

bind functionality #84

rutenkolk opened this issue May 10, 2019 · 2 comments

Comments

@rutenkolk
Copy link

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.

@rutenkolk
Copy link
Author

rutenkolk commented May 10, 2019

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

@roti
Copy link
Collaborator

roti commented May 17, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants