Layout resize (solved)

7 posts / 0 new
Last post
trixie
trixie's picture
Offline
Last seen: 5 months 4 hours ago
Joined: 2011-02-03 13:58
Layout resize (solved)

I have a ReAction window with a main layout that contains a horizontal child layout consisting of a bitmap image object sitting next to a label image object. I need to swap the child layout for another one when the window is NOT open. What I'm basically doing is:

- Attach the first child layout to the main window layout.
- Open the window.
- Close the window, remove the child layout, and attach the second child layout to the main layout.
- Open the window again.

The second child layout is smaller than the first one (because the bitmap and/or the label is smaller). The thing is: when I open the window, it remains the same size, whereas I'd like the window to adapt its size to the smaller layout size. What do I need to do? I don't want to call WM_RETHINK on the open window because this causes a visible resize, which looks quirky. I want to resize the layout before the window gets opened.

OldFart
OldFart's picture
Offline
Last seen: 51 min 48 sec ago
Joined: 2010-11-30 14:09
Re: Layout resize

Well, although I'm not hindred by a deep knowledge of such matters, after looking at the documentation I'd say that right after you've attached the second picture, but before reopening the window, you might issue a WM_RETHINK, as the method is applied to the window object and not to the window itself.

OldFart

trixie
trixie's picture
Offline
Last seen: 5 months 4 hours ago
Joined: 2011-02-03 13:58
Re: Layout resize

@OldFart

That was, of course, the very first thing I tried :-) Didn't work, unfortunately :-(

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

OldFart
OldFart's picture
Offline
Last seen: 51 min 48 sec ago
Joined: 2010-11-30 14:09
Re: Layout resize

That was, of course, the very first thing I tried
Yes, of course you did. Silly me.
Didn't work, unfortunately
That's a pity, but alas, to be expected.

Next thing:
(Close window 1st time)
Replace pointer to picture with NULL, RETHINK and reopen
or
Replace pointer to picture with ~0, RETHINK and reopen

or wait until salass00 and/or thomas to show up...

OldFart

thomas
thomas's picture
Offline
Last seen: 7 hours 39 min ago
Joined: 2011-05-16 14:23
Re: Layout resize

I think that it is a feature of window.class to keep the window at the same size even if you close and reopen it.

WM_RETHINK will make the window bigger if the layout does not fit, but it does not make the window smaller as long as the layout is scalable to the current window size.

You might try to set WA_Width and WA_Height to 0 after WM_CLOSE, then the next WM_OPEN should open the window at the smallest possible size.

IMHO WM_RETHINK should not be needed if you close the window because WM_OPEN implies a rethink.

broadblues
broadblues's picture
Offline
Last seen: 4 years 1 month ago
Joined: 2012-05-02 21:48
Re: Layout resize

If your window is closed while this change is made, why not simply dispose of it and make a new object ?

trixie
trixie's picture
Offline
Last seen: 5 months 4 hours ago
Joined: 2011-02-03 13:58
Re: Layout resize (solved)

@broadblues

If your window is closed while this change is made, why not simply dispose of it and make a new object?

Possible but sounds like an overkill to me. I'd prefer just updating the object.

@thomas

You might try to set WA_Width and WA_Height to 0 after WM_CLOSE, then the next WM_OPEN should open the window at the smallest possible size.

And Thomas Rapp saves the day again! :-) Thanks - I tried setting WA_InnerWidth and WA_InnerHeight to 0 and it indeed does the trick. I've also contacted Rigo if he knows of a smarter solution - should he come up with something I'll post it here.

WM_OPEN implies a rethink

But it apparently doesn't perform any, otherwise I wouldn't have this problem :-)

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

Log in or register to post comments