Re: surface ++= ?

Charles Goodwin <[email protected]> Thu, 15 Apr 2004 18:19:06 +0000
Newsgroups gmane.comp.java.xwt.widgets
Organization XWT Foundation
Message-ID <[email protected]>
On Thu, 2004-04-15 at 13:57 -0400, Brian Alliet wrote:
> The surface box property IS NOT the root box or anything. It has nothing to
> do with the actual root box. It is just a special property that "bubbles up"
> through the box hierarchy.

Sorry, I was mixing the term surface as in Surface (~root box) and
surface as in the surface object (a property of the root box).  That was
begging to be misinterpreted. ;)

> There isn't currently any way for a box to know when its [Surface and hence
> surface object] changes.

Which is what I want - for a box to know when it's Surface has changed.
I naively assumed this would be reflected by a change to it's surface
property, but this is possibly not practical.

> What widgets need to know when they change their surface and why do they
> need to know?

For example, popupmanager and focusmanager put functions on the surface
object.  Then, for instance, a focusable widget will want to register
itself with these functions but _cannot_ do so until the surface object
has been instantiated.

Since Ibex traverses the box hierarchy and creates leaves first, this
means we cannot refer to the surface property until after the creation
of a Surface and all of it's children has finished.

So we do:

SizeChange ++= function(v) {
    /* do stuff with surface.something */
    SizeChange --= callee; // unregister trap
}

Whilst being a bit hackish, this works initially.

However, if we want to do things like dragging tabs between frames, or
other such widget-moving-to-Surface stuff, this means we either:

1) don't --= callee in the SizeChange function - a bit inefficent?
   or
2) jump through hoops in special cases, which leaves us open to problems
   later on when somebody is bound to try moving normal widgets between
   Surfaces then get upset when it's a bit fubared.
-- 
- Charlie

Charles Goodwin <[email protected]>
Online @ www.charlietech.com