[fxruby-users] GUI Update technique

Lyle Johnson lyle at knology.net
Tue Aug 16 08:42:17 EDT 2005

On Aug 15, 2005, at 9:48 PM, James Stallings II wrote:

> Is the best way to do this to create all the top-level widgets (and
> their children) for an interface, and implement the update signals?
> Seems then I'd be able to create all the primary widgets, let the app
> change the values and send update signals back to the widgets and let
> them manage repainting themselves with the new values.
> Am I on the right track? if so, can anyone toss me any gems of wisdom
> before I try to get my head around the details?

The GUI update feature makes sense for you if it's not a time-sensitive 
thing. (I wasn't sure based on the things you've said in recent 

Whenever there's idle time in the GUI, it (FOX) will devote some time 
to the GUI update loop, in which it sends a SEL_UPDATE message to the 
widgets (in turn). They can use that opportunity to make sure that 
their settings (e.g. a label's text, or a dial's value) accurately 
reflects the current application state, e.g.

	viewLabel.connect(SEL_UPDATE) {
		viewLabel.text = modelText

There should be some examples of this in the FXRuby examples directory. 
Now, usually this happens very quickly because there's a lot more idle 
time in a GUI application than you might realize. But if you need a 
value to change at fixed times (e.g. for a little onscreen clock or 
something) you would probably need to use a timer instead.

Hope this helps,


More information about the fxruby-users mailing list