FXMisc / Flowless

Efficient VirtualFlow for JavaFX
BSD 2-Clause "Simplified" License
185 stars 38 forks source link

How to programmatically scroll to Node with ScrollPane that is bound to VirtualizedScrollPane #17

Closed JordanMartinez closed 8 years ago

JordanMartinez commented 8 years ago

I've asked this on StackOverflow, since that seems like the place to have that discussion. However, I am also opening an issue here because I think you, @TomasMikula , would probably be one of the few who could answer this specific question.

TomasMikula commented 8 years ago

Do the nodes in the ScrollPane have any correspondence to items in the VirtualFlow (assuming that the VirtualizedScrollPane contains a VirtualFlow). If so, I would bring the VirtualFlow's item to the viewport using VirtualFlow.showAsFirst(itemIndex) and let the ScrollPane adjust automatically.

JordanMartinez commented 8 years ago

Yes and no :-D

ScrollPane {
    HBox {
        LeafPane { // these Nodes match up with each line in StyledTextArea
            Node
            Nodes...
        }
        ParentPane { // these Nodes are unpredictable in their layout
            Node
            Nodes...
        }
        Higher ParentPanes and and their Nodes {} // unpredictable in their layout
    }
}

So, such a thing would work for the Nodes in the LeafPane but not for any in the ParentPanes

TomasMikula commented 8 years ago

Well, then it doesn't seem to be Flowless related. I don't know why your approach would not work. You can convert coordinates relative to a node to coordinates relative to its parent with the localToParent method. You will need to use it multiple times for deeper hierarchies.

JordanMartinez commented 8 years ago

Ok, I guess I'll have to play around it with some more.