Re: [Fxruby-users] timeouts...
Status: Inactive
Brought to you by:
lyle
From: Lyle J. <jl...@cf...> - 2003-07-29 17:33:48
|
Hugh Sasse Staff Elec Eng wrote: > I see that FXTimer is not used in the Ruby side of FXRuby. Instead > I see addTimeout() and removeTimeout methods of FXApp. I think I'm > fairly clear about how to use this (though I'll have to brush up on > define my own selectors). I'm not exactly sure what you mean. In the C++ library, there is an FXTimer class (or struct?) but it just acts as "handle" to a particular registered timeout event. In other words, it has no publically accessible methods or data, and you cannot create or destroy FXTimer objects directly. As you've already noted, for both the C++ library and FXRuby, you create a timeout event by calling FXApp#addTimeout and, if necessary, destroy it by calling FXApp#removeTimeout. > My question is: What does adding a timeout do to the object, and > should I be able to see the timeout when I marshal/yaml it? I'm > wondering if it would be prorgrammatically simpler to store the > timeouts with objects that I save to disk, so that if they are > restored "too late" then action is taken, just as if they never went > into persistant storage and the timeout happened normally. It may > bulk up the data, but if it means I write less code, that is > probably good. When you call FXApp#addTimeout to register a timeout event, it adds a new record to the application's internally-maintained list of timeout events. During the application's event loop, in addition to checking for mouse motion, button clicks, etc. it's also checking to see if any of those timeouts have expired. When a timeout comes due, the application sends a SEL_TIMEOUT message to the appropriate target (the one that you specificed when you added the timeout). None of the FXRuby objects are serializable via Marshal or YAML, so I'm not quite sure how to answer the last part of your question... |