home *** CD-ROM | disk | FTP | other *** search
- {$R+,S+,I+,D+,T-,F-,V-,B-,N-,L+ }
- {$M 16384,16384,16384 }
-
- PROGRAM KTOOLSDEMO;
-
- USES
- DOS,
- CRT,
- KTOOLS;
-
- VAR
- Regs : Registers;
- Str255: String;
- Str2 : String[2];
- Str80 : String[80];
- FAttr : Byte;
- Ch : Char;
- Lines : array[1..6] OF Byte;
- L,Z : Integer;
- YesNo : Boolean;
- Fore,Back : Integer;
- MyScreen : SaveScrType; {definováno v ktools.tpu jako array[1..4004] of byte }
- MyMenu : Array[1..9] of MenuItemType; {menuitemtype definováno v ktools.tpu}
- {jako string[30] }
- MyDesc : Array[1..9] of MenuDescType; {menudesctype definováno in ktools.tpu}
- {jako string[80] }
-
- BEGIN
-
- ClrScr;
-
- CursorOff;
-
- Randomize;
-
- KWrite(2,1,15,'This line is passed as actual param. to KWrite');
-
- Str80:='Hello world, I''m Drue Kennon! was passed as a variable.';
-
- KWriteV(5,1,12,Str80);
-
- KWrite(8,1,15,'Next line is actual & centered');
-
- KWriteC(9,11,'Hello world, I''m Drue Kennon!');
-
- Str80:='Hello World, I''m a centered variable.';
-
- KWrite(11,1,15,'Next line is varriable & centered');
-
- KWriteCV(12,6,Str80);
-
- Str80:=' I have 10 leading blanks and 10 trailing ones ';
-
- KWriteV(14,1,4,Str80);
-
- KTrim(Str80);
-
- KWrite(16,1,15, KUCase('now I have none on either side of me!') );
-
- Kwrite(18,1,3,Str80);
-
- KWrite(20,1,15,'Now to change the attributes of these lines!');
-
- KWrite(22,1,15,'Press any key to fill the screen via (KFill)');
- NEW(MyScreen);
- KSaveScr(1,1,25,80,MyScreen);
-
- Delay(5000);
-
- Lines[1]:=2;
- Lines[2]:=5;
- Lines[3]:=9;
- Lines[4]:=12;
- Lines[5]:=14;
- Lines[6]:=16;
-
- REPEAT
- FOR Z := 0 TO 15 DO
- FOR L := 1 To 6 DO KAttr(Lines[l],1,1,80,Z);
- UNTIL KeyPressed;
-
- Ch := ReadKey; {p⌐eçtená klávesa z klávesnice}
-
- CRT.TextAttr := Random(127) OR 128; {CRT. p⌐ed TextAttr není nutné}
- KFill(5,10,15,60,'*',TextAttr); {Je pouæito pouze pro objasnêní}
- Delay(3000);
- CRT.TextAttr := CRT.TextAttr MOD 128;
- KFill(5,10,15,60,'*',TextAttr);
- TextAttr := 7; {Aæ si p⌐estaneme hrát, vrátíme attr na jeho normální hodnotu }
-
- CursorOn;
-
- KWrite(22,1,color(15,0),' ');
- KWrite(23,1,15,'Enter a foreground color i.e. 10, 13 etc...: ');
- Read(Fore);
-
- KWrite(23,1,color(15,0),' ');
- Str80 := '';
- Str80 := 'Enter a background color i.e. 0, 5 etc...: ';
- KTrim(Str80);
- KWriteV(23,1,15,Str80);
- Read(Back);
-
- FAttr := Color(Fore,Back);
- KFill(5,10,15,60,'*',FAttr);
-
- MyMenu[1]:=' Turbo Pascal ';
- MyMenu[2]:=' Turbo Basic ';
- MyMenu[3]:=' Turbo "C" ';
- MyMenu[4]:=' Turbo Lightning ';
- MyMenu[5]:=' Turbo Prolog ';
- MyMenu[6]:=' Pascal ';
- MyMenu[7]:=' Basic ';
- MyMenu[8]:=' "C" ';
- MyMenu[9]:=' ProLog ';
- MyDesc[1]:='This is BORLAND''s Turbo Pascal Language';
- MyDesc[2]:='This is BORLAND''s Turbo Basic Language';
- MyDesc[3]:='This is BORLAND''s Turbo "C" Language';
- MyDesc[4]:='This is BORLAND''s Turbo Lightning a word processor utility';
- MyDesc[5]:='This is BORLAND''s Turbo Prolog Language';
- MyDesc[6]:='This is description number # 6 and the first item on menu page 2.';
- MyDesc[7]:='This is description number # 7 and the second item on menu page 2';
- MyDesc[8]:='This is description number # 8 and the third item on menu page 2';
- MyDesc[9]:='This is description number # 9 and the last menuitem; menuitemtotal=9';
- CursorOff;
-
- KBox(7,29,11,19,Color(Yellow,Blue),15,Border2,True);
- L := KVertMenu(2,MyMenu,9,30,8,30,17,15,Color(White,Red));
-
- KWrite(20,1,15,' ');
- KWrite(20,23,15,'Your Menu Selection Choice was ');
- Str(L,Str80);
- Kwrite(20,54,12,Str80);
-
- KWrite(22,1,15,' ');
- KWrite(23,1,15,' ');
- For L := 1 TO 9 DO KTrim (MyMenu[L]);
- KBox(21,4,4,72,45,15,border5,false);
- L := KHorizMenu(1,mymenu,mydesc,9,70,5,22,14,Color(White,Red),12);
-
- { Nyní pouæijeme BIOS k posunutí obrazovky nahoru o jeden ⌐ádek abychom si
- udêlali místo pro ná¿ p⌐íkaz na ⌐ádku 24 aniæ bychom poru¿ili okraj menu. }
- Regs.AH:=$06; { scroll funkce }
- Regs.AL:=1; { poçet ⌐ádek pro rolování }
- Regs.CH:=3; { çíslo nejvy¿¿ího ⌐ádku }
- Regs.CL:=0; { " sloupce }
- Regs.DH:=24; { çíslo spodního ⌐ádku }
- Regs.DL:=79; { çíslo nejpravêj¿ího sloupce }
- Regs.BH:=15; { attribut pro smazané ⌐ádky }
- Intr($10,Regs);{ interrupt }
-
- KWrite(24,1,15,' ');
- KWrite(24,23,15,'Your Menu Selection Choice was ');
- Str(L,Str80);
- Kwrite(24,54,12,Str80);
-
- KBox(1,1,25,80,55,15,border4,false);
-
- delay(3000);
-
- KRestoreScr(MyScreen);
- DISPOSE(MyScreen);
-
- Delay(5000);
-
- { Scrolling }
- Regs.AH:=$06; { scroll funkce }
- Regs.AL:=25; { poç. ⌐ádkû pro scroll }
- Regs.CH:=0; { nejvy¿¿í ⌐ádek }
- Regs.CL:=0; { nejlevêj¿í sloupec }
- Regs.DH:=24; { spodní ⌐ádek }
- Regs.DL:=79; { nejpravêj¿í sloupec }
- Regs.BH:=15; { attribut pro mazané ⌐ádky }
- Intr($10,Regs); { interrupt }
-
- (*
- Pokud si myslíte, æe toto je pouæitelné p⌐i va¿em programování,
- pouæijte tento zpûsob stejnê jako v p⌐íkladu popsaném níæe.
- *)
-
-
- KWrite(5,1,15,'Press any key to continue...');
- Ch := ReadKey;
-
- Str2 := KUCase(ParamStr(1));
- Ch := Str2[1];
- IF Ch IN['A'..'F'] THEN
- BEGIN
- YesNo := KUCase(ParamStr(2))='TRUE';
-
- Str255 := PikDir(ParamStr(1)+'\*.*',YesNo);
-
- KTrim(Str255);
- Str255:=KLCase(Str255);
- Str255 := 'You chose << '+Str255+' >>';
- KTrim(Str255);
- KWrite(10,1,13,Str255);
- END;
-
- TextAttr:=15;
- KWrite(15,34,14+128,'<< THE END >>');
- CursorOn;
- Halt;
-
- End.
-
- (*
-
- PROCEDURE Scroll(AL,CH,CL,DH,DL,BH:Byte);
- BEGIN
- Regs.AH:=$06; { scroll funkce }
- Regs.AL:=AL; { ⌐ádky pro scroll }
- Regs.CH:=CH; { vrchní ⌐ádek }
- Regs.CL:=CL; { levÿ sloupec }
- Regs.DH:=DH; { spodní ⌐ádek }
- Regs.DL:=DL; { pravÿ sloupec }
- Regs.BH:=BH; { attribut pro mazané ⌐ádky }
- Intr($10,Regs); { interrupt }
- END;
-
- *)