From: Michal S. <hra...@ce...> - 2009-09-25 13:17:31
|
2009/9/23 Simon Arnaud <rub...@an...>: > Michal Suchanek wrote: >> 2009/9/23 Simon Arnaud <rub...@an...>: >>> >>> I tried your example, but I don't see what's wrong. >>> >>> Is it supposed to demonstrate the problem ? >>> >> Yes, when you check the update checkbox the hscales are no longer >> movable. >> >> Perhaps I should have make it checked it to start with. > > I think 'on_xxxx_change_value' should return false/nil if you want the > scale to update, or true otherwise. > > change 'update min, max' to : > > def update min,max > if @update then > STDERR.puts "returning false, scale will move" > return false > else > STDERR.puts "returning true, scale will NOT move" > return true > end > end > > Since ruby returns your last statement, it returns max for you, which is > always true. However, when you call queue_draw, it returns false, so, > you on_xxx_change_value returns false. > Indeed, moving the handler to value_changed handler resolves the problem. Unfortunately, this is not documented for ruby-gnome2. Thanks Michal |