Hi, Please, help me, how to detect when terminal window resizes ? My OS is REDHAT. Thanks
--------------------------------- Do you Yahoo!? Yahoo! Search - Find what youre looking for faster.
Doan Ngoc San wrote:
Please, help me, how to detect when terminal window resizes ? My OS is REDHAT.
Your program will get a SINGWINCH signal which you can trap using:
InstallSignalHandler (SigWinCh, ...)
(unit GPC required). If you're using CRT, you don't have to do this yourself, and ReadKey/ReadKeyWord will return ksScreenSizeChanged/kbScreenSizeChanged when it happens. (But don't use CRT just for this if you wouldn't need it otherwise.)
Frank
On Thu, Mar 04, 2004 at 05:40:23AM -0800, Doan Ngoc San wrote:
Hi, Please, help me, how to detect when terminal window resizes ? My OS is REDHAT. Thanks
- if you use the CRT unit: ReadKeyWord will return a virtual "function key" kbScreenSizeChanged after a resize
- otherwise: the kernel will signal your application with SIGWINCH, which you can detect if you install a signal handler, like this:
program WinCh (Input, Output);
uses GPC;
procedure MyHandler (Sig: Integer); begin WriteLn ('Terminal was resized.') end;
var Dummy: Boolean;
begin Dummy := InstallSignalHandler (SIGWINCH, MyHandler, True, False, Null, Null); { this is just a dummy loop, as an example: } while not EOF do ReadLn end.
Emil Jerabek