Reference » Messages » RectChanging

RectChanging (message)


Window's size and/or position (including z-order) are about to change.


This message is generated as a result of calling MWindow::setRect or related function (e.g. MWindow::setSize). The message is received by the same window that called MWindow::setRect just before the actual change (MWindow::getRect and related functions still return the previous size and position). This message provides the window with an opportunity to adjust the new size and position, or even to cancel the change, by editing fields of an MRect reference, returned by MWindow::digRectRef. A change in each component of the rect can be cancelled by setting it to Same. It is not recommended to do anything else during OnRectChanging, other than adjusting the new rect, even though it is not forbidden. After the OnRectChanging returns, this modified rect is used to actually set the new size and/or position. If the new position is different from the previous one, the Moved message is received right after this message. If the new size is different from the previous size, the Resized message is received right after this message (and after Moved, if any). If a window is resized/moved with animation (see MWindow::setRect), only one RectChanging message is received just before the animation starts (MWindow::digRectRef contains the final projected size/pos after the animation), followed by multiple Resized and/or Moved messages during the animation.

This message is also generated, if MWindow::getRect, or MWindow::getPos, or MWindow::getSize is called on a newly created, non-finalized window (see MWindow::MWindow), because it is necessary to determine the actual size and position of the window (which depends on OnRectChanging), if they are being queried.

This message is not received if the rect is changed by an external system command, or internally by Elgrint.

'RectChanging' is mostly used for two purposes: auto-size/auto-position support, and minimal/maximal size limits (see Example).



Let us know

Please Contact us to report any errors on this page, or to suggest any improvements.

Miranor Home | About Miranor | About Elgrint | Create account | Login | Account settings | Contact Us | Privacy Policy | Site map

© Copyright 2014 by Miranor. All rights reserved. By using this site you agree to the Terms of Use.

Page last updated on August 10th, 2014.