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

Auto-scroll memory when selection goes outside the visible #37

Open
Zomis opened this issue Dec 2, 2015 · 2 comments
Open

Auto-scroll memory when selection goes outside the visible #37

Zomis opened this issue Dec 2, 2015 · 2 comments

Comments

@Zomis
Copy link
Owner

Zomis commented Dec 2, 2015

Scroll the memory list when the current memory index is not visible

@Zomis Zomis added this to the 0.4.2 milestone Dec 2, 2015
@Zomis
Copy link
Owner Author

Zomis commented Dec 5, 2015

This doesn't seem to be that easy, as JavaFX 8 doesn't seem to provide the methods one could expect for this.

  • Get ScrollBar from ListView and get the current scroll position of it
  • Get topmost index currently visible
  • Get number of indexes visible at any time

Some code I have been trying, none of which prints anything at all.

    for (javafx.scene.Node node : memoryList.lookupAll(".scroll-bar")) {
        if (node instanceof ScrollBar) {
            final ScrollBar bar = (ScrollBar) node;
            bar.valueProperty().addListener(new ChangeListener<Number>() {
                @Override public void changed(ObservableValue<? extends Number> value, Number oldValue, Number newValue) {
                    System.out.println(bar.getOrientation() + " " + newValue);
                }
            });
        }
    }

    this.memoryList.onScrollFinished = {ScrollEvent event ->
        def units = event.getTextDeltaYUnits()
        println "units $units y $event.y textDeltaY $event.textDeltaY sceneY $event.sceneY"
    } as javafx.event.EventHandler<ScrollEvent>

@Zomis Zomis modified the milestones: 0.6, 0.4.2 Dec 5, 2015
@Zomis Zomis added the ide label Dec 13, 2015
Zomis added a commit that referenced this issue Dec 13, 2015
@Zomis Zomis modified the milestones: 0.5, 0.4.2 Dec 17, 2015
@Zomis
Copy link
Owner Author

Zomis commented Dec 19, 2015

This might help with implementing this: https://github.com/TomasMikula/Flowless
See also the Javadoc for Cell.updateItem

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

No branches or pull requests

1 participant