Re: Trapping Box Properties?

Charles Goodwin <[email protected]> Thu, 15 Apr 2004 15:07:40 +0000
Newsgroups gmane.comp.java.xwt.core
Organization XWT Foundation
Message-ID <[email protected]>
On Thu, 2004-04-15 at 10:33 -0400, Brian Alliet wrote:
> $mybox.height = 100;
> and
> ibex.ui.frame = $mybox // then resizes the frame

Not the greatest example as here (I think) the resizing frames does
adjust the maxheight.  Even if not, I think I can offer insight...

Having sat down and thought about the issue, I think I understand what
Adam is intending.  In fact, it's not much of a departure (if at all)
from the way things currently work.

The trick is remembering that width/height are _not_ directly writable
properties.  When you write to width the core actually writes to
maxwidth/minwidth.  Then the core will update the width of the box if
this has changed anything, and in doing so will put to width.

What Adam is saying is that instead of SizeChange, we'll use write traps
on width/height - which will only be triggered when the core changes
width/height since actually the user can never directly do so.

Consider this example:

<ui:box width="200">
  <ui:box id="b" maxwidth="300" minwidth="100" />
</ui:box>

$b.width ++= function(v) { ... }

If you then do '$b.width = 200;', the width trap will never actually be
triggered because the core evaluates it as:

  * request width put 200
  * set maxwidth/minwidth to 200
  * re-evaluate box size
  * box size the same, don't put to width

When put into context, this does actually make sense.

However the debate is really whether this is too confusing or not, or
whether it's actually a good thing as it imposes an understanding of how
box dimensions are evaluated in Ibex.

Still, that's what I think Adam is thinking.  Can't guarrantee it.
-- 
- Charlie

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