Re: [Fxruby-users] Dialogues, and create.
Status: Inactive
Brought to you by:
lyle
|
From: Lyle J. <jl...@cf...> - 2003-07-03 14:09:39
|
Hugh Sasse Staff Elec Eng wrote:
> The next thing I'll need to know is: Where can I generalize this
> behaviour: are there other calls that propagate like this?
The other two that immediately come to mind are the detach() and
destroy() methods.
You may already understand that the purpose of calling create() is to
create and then bind a native windowing-system entity (e.g. a X window,
or a Win32 GDI font) to an already-existing FOX object (like an FXWindow
or FXFont instance).
Calling detach() on a FOX object reverses part of the effect of
create(); it breaks this binding between the FOX object and its
window-system entity, but it doesn't actually destroy either of them.
And like create(), detach() does its thing recursively, from parent to
child windows.
Calling destroy() goes one step further (if you want to think of it that
way) and actually destroys the window-system entity. Note that it
doesn't destroy (garbage-collect) the FOX object, just the X window or
whatever that was backing it up. An important distinction, though, is
that destroy() is not as aggressive as create() and detach() in terms of
its recursive behavior. Specifically, calling destroy() on a widget will
not destroy any of its shared resources, like fonts or icons. Suppose
you create an icon:
anIcon = FXPNGIcon.new(getApp(), ...)
and then associate it with two different widgets (a label and a button):
aLabel.icon = anIcon
aButton.icon = anIcon
Now suppose that at some point later you call destroy() on the button:
aButton.destroy
It is clear that you want to blow away the X window (or Win32 window)
underlying that FXButton instance, but you don't want to destroy the
icon too since someone else may still be using that resource. And in
this case, of course, that "someone else" is the label.
There are other behaviors in FOX that are recursive, e.g. the manner in
which the layout algorithm works, but right offhand I can't think of any
other APIs that you'd deal with directly that have a recursive nature. I
am sure that as soon as I send this post, someone will point out some
cases I forgot about, though ;)
Hope this helps,
Lyle
|