isresizeevent


Syntax
#include "graphics.h"
bool isresizeevent( );
Description[WIN]
The isresizeevent function is available in the winbgim implementation of BGI graphics. This function returns true if there the window has been resized by the user and the clearresizeevent function has not subsequently been called. The function actually detects the WM_EXITSIZEMOVE event, which means that moving a window could also trigger this function to return true.

Once this event has been detected, the program can redraw the screen if necessary, using the getmaxx and getmaxy functions to determine the new size of the screen. Afterward, the program should call clearresizeevent so that the isresizeevent function doesn't continue to return true.

Note: For information on how to create a window that the user can resize, please see the documentation for the final argument of initwindow.

Return Value
True if there is an unprocessed resize event; otherwise false.

See also
clearresizeevent
getmaxx
getmaxy
initwindow

Example
/* resize example */ 
#include "graphics.h"

void main(void)
{
    int maxx, maxy;  // Maximum x and y pixel coordinates
    int x, y;        // Coordinates of the mouse click
    int divisor;     // Divisor for the length of a triangle side

    // Put the machine into graphics mode and get the maximum coordinates:
    initwindow(450, 300, "", 600, 200, false, false, WS_POPUP|WS_THICKFRAME);         
    maxx = getmaxx( );
    maxy = getmaxy( );

    cout << "WIDTH:  " << getmaxx( )+1 << endl;
    cout << "HEIGHT: " << getmaxy( )+1 << endl;

    do
    {
        clearviewport( );
        line(0, 0, getmaxx( ), getmaxxy( ));
        while (!isresizeevent( ) & !kbhit( ))
        {
            delay(1000);
        }
        clearresizeevent( );
    }   while (!kbhit( ));

    // Switch back to text mode:
    closegraph( );
}

Back to index