home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
library
/
dos
/
tegl_ii
/
intro
/
resize.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-04-06
|
2KB
|
66 lines
Program ExResize;
{-- this program illustrates how to define a mouse click area, specifically }
{-- a resize click area and how to associate an event that will be called }
{-- by the supervisor whenever the frame is resized. }
USES TEGLFont,FastGrph,TGraph,VirtMem,
TEGLUnit,TeglMain,TeglSpec;
{$F+}
Procedure DrawWinFrame(ifs : ImageStkPtr); FORWARD;
{-- Just draws a frame with a rectangle in the corner which will }
{-- be the resize mouse click area. }
Procedure FrameIt(ifs : ImageStkPtr);
BEGIN
SetFillStyle(SolidFill,White);
SetViewPort(0,0,getmaxx,getmaxy,clipoff);
Bar(ifs^.x,ifs^.y,ifs^.x1,ifs^.y1);
SetColor(black);
Rectangle(ifs^.x,ifs^.y,ifs^.x1,ifs^.y1);
Rectangle(ifs^.x1-10,ifs^.y1-10,ifs^.x1-1, ifs^.y1-1);
END;
{-- event that is called automatically after a resize mouse click area }
{-- is selected and the frame is resized. }
Function ReDrawWinFrame(ifs : ImageStkPtr; ms : MsClickPtr) : Word;
BEGIN
DrawWinFrame(ifs);
END;
{-- Draw the window frame and define the the mouse click area for the }
{-- resizing action }
Procedure DrawWinFrame(ifs : ImageStkPtr);
VAR mx, my : Integer;
BEGIN
FrameIt(ifs);
ResetMouseClicks(ifs,nil);
mx := ifs^.x1 - ifs^.x;
my := ifs^.y1 - ifs^.y;
{-- set framesize constraints }
DefineResizeMinMax(ifs,100,100,400,200);
{-- set the mouse click area }
DefineResizeClickArea(ifs,mx-10,my-10,mx,my,ReDrawWinFrame);
END;
VAR
Window : ImageStkPtr;
BEGIN
EasyTegl; {-- standard set up }
EasyOut;
PushImage(100,100,300,200); {-- save background }
Window := StackPtr; {-- get the pointer }
DrawWinFrame(Window); {-- draw it the first time }
TEGLSupervisor; {-- give it to the supervisor }
END.