ericssmith / scalafx

Automatically exported from code.google.com/p/scalafx
Other
0 stars 0 forks source link

Problem with ListView.scrollTo(Int) #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi all;

I have a problem using ScalaFX ListView:
I have a ListView filled with an ObservableBuffer[String]. I can set one 
particular item selectedby default but I can't scroll to it (so that the user 
see it selected when apllication is opened).

When I use myListView.scrollTo(itemIndex), then no item at all is displayed in 
my listView (I made sure that itemIndex is not out of range).

I am using scalafx 2.10 _ 1.0.0-M7 on Windows. 

Thanks a lot for your help.

Original issue reported on code.google.com by poisat.j...@gmail.com on 4 Mar 2014 at 10:43

GoogleCodeExporter commented 9 years ago
This does not look to me as an issue in ScalaFX. It actually behaves 
differently in JavaFX 2.2 and JavaFX 8. Attached is a sample code that works 
correctly in JavaFX 2.2 (ListViewWithScrollDemo.scala). Note that `scrollTo` is 
invoked with a delay on application thread:

    Platform.runLater {
      scrollTo(4)
    }

Interestingly this is not needed in JavaFX 8. Let me know if using 
`Platform.runLater {}` resolves you problem.

Original comment by jpsacha on 7 Mar 2014 at 9:20

GoogleCodeExporter commented 9 years ago
RunLater works fine, thanks a lot!

Original comment by jpoi...@hotmail.fr on 10 Mar 2014 at 8:18

GoogleCodeExporter commented 9 years ago

Original comment by jpsacha on 11 Mar 2014 at 3:49