Discussion:
Recursive resize events
Emiliano Heyns
2003-04-12 19:11:26 UTC
Permalink
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
Andrew Kohlsmith
2003-04-13 00:53:01 UTC
Permalink
Post by Emiliano Heyns
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?
I ran into this exact same problem with my dhsp app. I solved it by making
sure that the root frame was bigger than I needed it to be. Inelegant, but
it worked for me.

Basically whenever we get the "root frame shrink=true does what every other
box does" bug fixed, this will go away. AFAIK there is no other good
workaround.

Regards,
Andrew

_______________________________________________
http://lists.xwt.org/listinfo/dev
Charles Goodwin
2003-04-14 08:25:44 UTC
Permalink
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:***@iris-advies.nl]
Sent: 12 April 2003 20:11
To: ***@xwt.org
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

Loading...