Re: [Fxruby-users] Dialogues, and create.
Status: Inactive
Brought to you by:
lyle
From: Hugh S. S. E. E. <hg...@dm...> - 2003-07-02 15:17:09
|
On Wed, 2 Jul 2003, Lyle Johnson wrote: > Hugh Sasse Staff Elec Eng wrote: > > >> Isn't the create() call propagated from parent to child? > > > > Then why isn't it always? I have found that I have to call create on > > the children before the parent, in the few cases I have done this so > > far. > > Hugh, > > Sorry for the delayed response. Joel was correct in his response that > when you call create() on a parent window, it recursively calls create() > on all of its child windows that exist at that time. Also, even though > FXApp is not itself a "window", calling FXApp#create will call create() > on all of the top-level windows (e.g. main windows and dialog boxes) > that exist at the time create() is called. OK, that is clear now.... > [...] > I'm trying to think of any exceptions to the rule and I don't know that > there are any. What may be tripping you up, and what frequently throws > people, is that create() only realizes widgets that exist at the time > that create() is called. In other words, say you construct a dialog box: This could be what happened to me. I will have another look at my code to see if that is true. Thank you. The next thing I'll need to know is: Where can I generalize this behaviour: are there other calls that propagate like this? > > or, since calls to create() are recursive, you could call create() on > the dialog again: > > dialog.create Could I call it on FXApp again? Hmm, what about class Class alias_method :old_new, :new def new(*args) result = old_new(*args) $fxapp.create if self.ancestors.include?(FXObjectt) return result end end or something? > > Calling create() repeatedly on the same object is safe, at least for the > built-in FOX classes. They will still recurse through the list of child > windows, but only actually create the windows that haven't been realized > yet. > > Hope this helps, Yes, this is clear now. thnak you. > > Lyle > |