The trouble with Skins
Tom Eugelink
tbee at tbee.org
Sun Mar 22 15:18:19 UTC 2015
On 22-3-2015 13:53, John Hendrikx wrote:
> On 22/03/2015 09:59, Tom Eugelink wrote:
>> On 22-3-2015 00:12, John Hendrikx wrote:
>>>
>>> What I do need however is a way to restore the control to the exact same state it was in before (the same amount of pixels scrolled, the same item at the top, the same item at the bottom).
>>
>> That is an interesting use case. Can you describe it a bit more?
>>
>> Tom
>>
> My app works more like a browser, so when I "go back", I expect the same screen layout again (even though I have to reconstruct the screen again). With a ListView, this cannot be done as the #scrollTo method only shows an item. It doesn't remember however if that item was somewhere in the middle, top or bottom. It's just convenient if it was in the same spot, as the user might expect it there. Just like I expect my browser to go back to the same spot helps me a bit (eg: I clicked the link at the bottom of the screen somewhere, and there was something else interesting to the left of it -- that fails if it is now somewhere else).
>
Ah, ok. So I am curious; even though the browser main scrollbar might return to the position you were before (or even when refreshing a site might do), will it also return divs-with-scrollbar to the same position? I doubt it.
But HTML is much more low level than JavaFX's controls; if you were to build a JavaFX screen just using primitive controls, so create your own list with a pane and a scrollbar, then that scrollbar's API is available and you can do what you want. As soon as you start encapsulating things, then it becomes more interesting. Does for example JSF's list control allow you to specify the scroll position, or JQuery tables?
More information about the openjfx-dev
mailing list