setcurrentwindow


Syntax
#include "graphics.h"
void setcurrentwindow(int window);
Description[WIN]
The setcurrentwindow function is available in the winbgim implementation of BGI graphics. You do not need to include conio.h; just include graphics.h.

The function changes the current window for all graphics operations to the specified window. This window number must be a number returned by the initiwindow functiion. The current window is the window where all other graphics operations will take place.

Note: Initwindow and initgraph both set the current window to the newly created window, so there is no need to call setcurrentwindow immediately after opening a new window. parameters have default values.

See also
getcurrentwindow
initgraph
initwindow

Example
/* setcurrentwindow example */ 
#include 

int main(void)
{
   int big;
   int w, w_right, w_below ;
   int width, height; // Total width and height of w_left;
   
   big = initwindow(getmaxwidth( ), getmaxheight( ), "Big");   
   w = initwindow(300, 200, "Top/Left Corner");
   width = getwindowwidth( );
   height = getwindowheight( );
   w_right = initwindow(300, 200, "Right", width, 0);
   w_below = initwindow(300, 200, "Below", 0, height);

   setcurrentwindow(big);
   line(0, 0, getmaxwidth( )-1, getmaxheight( )-1);
   /* clean up */
   getch();
   closegraph();
   return 0;
}

Back to index