General Terminal

GtSetResizeCallback

Install a callback for terminal size changes

Syntax

Signature
void GtSetResizeCallback( ItemBlock block );

Arguments

block is called with 0 after a size change. The driver ignores its return value. Pass NULL to remove the callback.

Return value

No return value.

Description

Use the callback to read the updated dimensions and adjust the layout. Support for resize notifications depends on the active driver.

Example

gtsetresizecallback.c
#include "xdev-wtui.h"

#include <stdio.h>

static int onResize( int value )
{
   ( void )value;
   printf( "Window: %d x %d\n", GtGetWindowWidth(), GtGetWindowHeight() );
   return 0;
}

int main( void )
{
   GtSetResizeCallback( onResize );
   puts( "Resize the window within five seconds." );
   Inkey( 5, NIL );
   GtSetResizeCallback( NULL );

   return 0;
}

See also