Re: [Fxruby-users] FXList#makeItemVisible and ruby threads
Status: Inactive
Brought to you by:
lyle
From: Joel V. <vj...@PA...> - 2003-12-24 05:05:32
|
Joel VanderWerf wrote: > > I'm updating a FXList from a thread, and I'd like to > always scroll to the last item. This is what I tried: > > require 'fox' > include Fox > > app = FXApp.new("List", "TEST") > win = FXMainWindow.new(app, "list") > list = FXList.new(win, 10) > Thread.new do > 20.times do |i| > list << i.to_s > # sleep 0.1 > list.makeItemVisible(list.numItems-1) # no effect > sleep 0.1 > end > end > win.show > app.create > app.run > > As it is, the makeItemVisible has no effect, immediate or delayed. > However, if I uncomment the first sleep, it has an immediate effect, as > desired. > > Does that make sense? I guess a better question is, what is happening during that first sleep that I could do manually (without sleeping) to ensure that the makeItemVisible call has an effect? I've tried recalc, update, flush, forceRefresh. Overkill, I know, but all in the name of science... Actually, I've found that Thread.pass has the same effect as sleeping, so I guess I'll just use that. |