Re: Recursive resize events

Charles Goodwin <[email protected]> Mon, 14 Apr 2003 09:25:44 +0100
Newsgroups gmane.comp.java.xwt.general
Message-ID <308906BE5D07D5119285009027D61C5722F6F3@NTFPS1>
The solution to this is to make the first child box absolute:

<template thisbox="frame" />
    <box id="w" absolute="true">
    .
    .
    .
    </box>
</template>

(You may even be able to just put absolute="true" on the template - try it)

If the box is not absolute, it's being resized to the size of the frame (in
accordance with the XWT layout rules - see the reference) and then
_SizeChange if being fired, resizing according to your settings, then being
resized back down to the size of the frame.

The 'absolute="true"' is much more elegant than Andrew's suggestion. ;)

-----Original Message-----
From: Emiliano Heyns [mailto:[email protected]]
Sent: 12 April 2003 20:11
To: [email protected]
Subject: [xwt-dev] Recursive resize events


I have the following:

     _SizeChange = function() {
       w = xwt.math.max($lblGroup.width, $lblName.width);
       w = xwt.math.max($lblUsername.width, w);
       w = xwt.math.max($lblPassword.width, w);
       w = xwt.math.max($lblPasswordConfirm.width, w);
       xwt.println('resize to ' + w);
       if (w == 0) { return; }
       w += 10;
       $lblGroup.width = $lblName.width = $lblUsername.width = 
$lblPassword.width = $lblPasswordConfirm.width = w;


If the window starts out with a size larger than the initial size of the 
contained widgets, all goes well. If I set the root frame to be smaller, 
it calls SizeChanged in rapid succession, ending with

Box: Warning, more than 500 SizeChange/PosChange traps triggered since 
last complete render

I don't need to do this in the SizeChange trap, but why is it happening 
under these specific circumstances, and not if the root pane is 
initially bigger?

Emile


_______________________________________________
http://lists.xwt.org/listinfo/dev
_______________________________________________
http://lists.xwt.org/listinfo/dev