[fxruby-users] FXDataTarget & widget value update delay

Lyle Johnson lyle at knology.net
Tue Oct 3 14:24:20 EDT 2006


On Oct 3, 2006, at 10:34 AM, Philippe Lang wrote:

> When assigning a new value to an FXDataTarget programmatically, it  
> takes a certain time for the widget linked to this FXDataTarget to  
> be updated, just as if there was some sort of "polling" inside the  
> framework. Delay can be as long as 1 second sometimes. Why aren't  
> the widgets updated straight away?

The update of a widget's settings due to a change in a data target's  
value is handled by FOX's GUI update mechanism, described here:

	http://www.fox-toolkit.org/guiupdate.html

This process only kicks in during idle time in the GUI, so there's  
inevitably going to be some small delay. The problem is compounded in  
FXRuby due to the overhead required for converting back and forth  
between C++ objects and Ruby objects, as well as scheduling Ruby  
threads. If your FXRuby application doesn't use any threads, you can  
try turning off FXRuby's support for scheduling Ruby threads by  
calling the FXApp's disableThreads() method:

	app.disableThreads

Yet another option, but one which sort-of defeats the purpose of the  
GUI update process, is to call forceRefresh() directly whenever you  
make a change to the data target's value, e.g.

	datatarget.value = "Foo"
	app.forceRefresh

Calling forceRefresh() causes the application to immediately start  
the GUI update process without waiting for idle time.

Hope this helps,

Lyle


More information about the fxruby-users mailing list