Resizing Windows on Mode Changes
Steve Fryatt (216) 2046 posts |
What’s the correct way to handle the resizing of windows (such as ones which fit the width or height of the screen) when the desktop mode changes? I’m having a number of problems with visible areas not being correct, and I’m wondering if I’m missing something obvious. At present, I’m listening out for Message_ModeChange then setting the extent and reopening at the new visible area. However, the window seems to end up back at it’s old position again. The ROOL PRM states that the Wimp will raise an Open_Window_Request after the message. Should I be flagging the new dimensions and then updating the position when this event arrives, instead of calling Wimp_Open_Window whilst handling the mode change message? |
GavinWraith (26) 1532 posts |
I seem to recall that Zap’s Redraw module has an example in BASIC, as part of the documentation on how to use it, which shows how to deal with desktop mode changes. Apologies if this is not pertinent. |
Steve Fryatt (216) 2046 posts |
I think I’ve got to the bottom of this now, after a bit of experimentation. The key bit seems to be that Open_Window_Request event hinted at by the PRM, which is indeed raised. The problem is that it arrives with the old window location – ignoring any changes made whilst responding to Message_ModeChange and so putting the window back to where it was before it was updated for the new mode. Updating the code so that the Message_ModeChange handler only sets up variables which define the size of the window, and leaving all calls to Wimp_OpenWindow to take place in response to the subsequent Open_Window_Request, resolves the problem. It also makes for neater code, as is so often the case once one actually understands how to use the Wimp properly. The code in question is a bit on the vintage side, and there’s been a lot of streamlining possible in my quest to make it releasable! |