home *** CD-ROM | disk | FTP | other *** search
- {$I switches.inc}
- {-------------------------------------------------------------------}
- { TWDEMO.PAS }
- { Copyright 1991 TEGL SYSTEMS CORPORATION, All rights reserved. }
- {-------------------------------------------------------------------}
-
-
- {$F+} {-- far call is necessary for EVENTS }
-
- Uses
- teglfont, {-- the graphics group }
- fastgrph,
- tgraph,
-
- virtmem, {-- memory }
-
- teglintr,
- teglunit, {-- window manager, menus and micellaneous }
- teglmenu,
- teglmain,
- teglspec,
-
- twcommon, {-- high-level windows }
- twkernel,
- twwindow,
- twworld,
- twdialog,
- twcontrl;
-
-
- {-- Global variables }
-
- VAR
- mainmenu: ImageStkPtr; {-- the main bar menu is only an ordinary frame}
- {-- with option menu click areas placed on it. }
- menufont: pointer; {-- the font to use with all menus. Set once so }
- {-- we can make the program look better on }
- {-- a variety of video displays. }
- fileom : optionmptr;
- dialogom : optionmptr;
-
-
- function dialogclose(ifs : ImageStkPtr; ms: MsClickPtr): Word;
- begin
- dialogclose := twdClose(ifs,ms);
- end;
-
- {-- Opens up a simple dialog window. }
-
- Function OpenDialogDemo(ifs: ImageStkPtr; ms: MsClickPtr): Word;
- VAR tempifs : imagestkptr;
- wf : winframeptr;
- i,j : integer;
- BEGIN
- for i:=1 to 5 do
- begin
- twdInit(wf,100,100,400,300);
- twSetHeader(wf,'Simple Dialogue');
- twdAddLabel(wf,10,10,'Labels go anywhere');
- twdAddbutton(wf,50,150,'OK',nilunitproc);
- twdAddButton(wf,180,150,'CANCEL',dialogclose);
- twSetCloseEvent(wf,dialogclose); {-- the space bar menu }
- twDrawWindowFrame(wf);
- end;
-
- twdInit(wf,50,50,600,350);
- twdAddLabel(wf,10,10,'Labels go anywhere');
- twdAddLabel(wf,10,10,'Labels go anywhere');
- twdAddLabel(wf,10,10,'Labels go anywhere');
- twdAddLabel(wf,10,10,'Labels go anywhere');
- twdAddLabel(wf,10,10,'Labels go anywhere');
- for i:=1 to 10 do
- for j:=1 to 8 do
- twdAddbutton(wf,i*44,10+j*25,'OK',nilunitproc);
-
- twdAddbutton(wf,10,250,'OK',dialogclose);
- twSetCloseEvent(wf,dialogclose); {-- the space bar menu }
- twDrawWindowFrame(wf);
- END;
-
-
- BEGIN
- {-- simple start up, minimal normal heap, TWCOMMON }
- twEasyStart;
- setkeyboardmouse(false);
-
- {-- set the font to use in window headers, TWCOMMON }
- twSetHeaderFont(@f8x12bol);
-
- menufont := @f8x12bol; {-- set the font to use on the menu }
-
- FileOm := CreateOptionMenu(MenuFont);
- DefineOptions(FileOm,' E~x~it ',true,twExitOption);
-
- DialogOm := CreateOptionMenu(MenuFont);
- DefineOptions(DialogOm,'~M~any',True,OpenDialogDemo);
-
-
- SetTeglFont(menufont); {-- bar menu uses the current font }
- CreateBarMenu(0,0,getmaxx);
- MainMenu := StackPtr; {-- just another frame }
- OutBarOption(' ~F~ile ', FileOm);
- OutBarOption(' Dia~l~ogues ',DialogOm);
-
- setautorotate(true); {-- windows rotate to the top automatically }
- teglsupervisor; {-- do not adjust your set, the supervisor }
- {-- is in control! }
- END.