home *** CD-ROM | disk | FTP | other *** search
- Program Illustrating_Screen_Editing;
-
- uses CRT, FastTTT, DOS, WinTTT, KeyTTT, MenuTTT, IOTTT;
-
- var
- Str1,
- Str2,
- Str3,
- Str4,
- Str5,
- Str6,
- Str7,
- Str8 : string;
- Code : integer;
- Ch : char;
-
- Procedure Display_Options(var Str :string);
- var
- M : Menu_Record;
- Pick, Retcode : integer;
- const
- T1 = 'Amoco';
- T2 = 'Conoco';
- T3 = 'Texaco';
- T4 = 'Technoco';
- begin
- With M do
- begin
- Heading1 := '';
- Heading2 := '';
- Topic[1] := T1;
- Topic[2] := T2;
- Topic[3] := T3;
- Topic[4] := T4;
- TotalPicks := 4;
- PicksperLine := 1;
- Addprefix := 0;
- Margins := 0;
- TopLeftXY[1] := 65;
- TopLeftXy[2] := 5;
- BoxType := 1;
- AllowEsc := true;
- Colors[1] := lightgray;
- Colors[2] := black;
- Colors[3] := black;
- Colors[4] := lightgray;
- Colors[5] := white;
- end; {with M}
- Pick := 1;
- WriteAT(62,7,white,lightgray,'<--');
- DisplayMenu(M,true,Pick,retcode);
- WriteAT(62,7,white,lightgray,' ');
- If Retcode <> 0 then
- Str := ''
- else
- Case Pick of
- 1 : Str := T1;
- 2 : Str := T2;
- 3 : Str := T3;
- 4 : Str := T4;
- end; {Case}
- end; {Proc Display_Options}
-
- {$F+} {must be defined as far}
- Procedure Special_Keys(Ch: Char; FieldID : integer;var ReturnStr: string);
- {you can define additional keystrokes to perform other no-standard IO operations
- such as field-sensitive help, defined input procs etc. This is a replacement for
- IOHELPPROC in TTT 3.0.
-
- In this example we will define the F1 key to display a company list if the
- Field ID is 2}
- begin
- If (Ch = #187) and (FieldID = 2) then
- Display_Options(ReturnStr);
- end;
- {F-}
-
- begin {test program}
- Str1 := '';
- Str2 := '';
- Str3 := '';
- Str4 := '';
- Str5 := '';
- Str6 := 'TX';
- Str7 := '';
- Str8 := '';
-
- IO_Setfields(8);
-
- IO_UserHook := @Special_Keys;
- IO_SetColors(15,4,11,1,14,4);
- IO_SoundBeeper(false);
- IO_AllowEsc(True);
- IO_DefineStr(1, 1,2,1,2, 30,6,Str1,'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');{name}
- IO_DefineStr(2, 1,3,1,3, 30,7,Str2,'*******************************');{Co.}
- IO_DefineStr(3, 2,4,2,4, 30,8,Str3,'*******************************');{ad1}
- IO_DefineStr(4, 3,5,3,5, 30,9,Str4,'*******************************');{ad2}
- IO_DefineStr(5, 4,6,4,6, 30,10,Str5,'@@@@@@@@@@@@@@@@');{city}
- IO_DefineStr(6, 4,7,5,7, 55,10,Str6,'!!');{state}
- IO_DefineStr(7, 4,8,6,8, 65,10,Str7,'#####-####');{zip}
- IO_DefineStr(8, 5,1,7,1, 30,12,Str8,'(###) ###-####'); {work Phone}
- IO_DefineMsg(1, 0,25,'Name is automatically set to capitals');
- IO_DefineMsg(2, 0,25,'Enter Company Name, press F1 for a list of companies');
- IO_DefineMsg(5, 0,25,'Now you can only type alphas and punctuation');
- IO_DefineMsg(6, 0,25,'Default is set to Texas');
- IO_DefineMsg(7, 0,25,'Zip and phone number must be numeric');
-
- ClearText(1,1,80,25,red,lightgray);
- Box(1,1,80,25,red,lightgray,3);
- WriteCenter(2,blue,lightgray,'TechnoJocks Turbo Toolkit');
- WriteCenter(3,white,lightgray,'Screen Input Routines Demonstration');
- WriteAT(12,6,blue,lightgray,'Incumbents Name =>');
- WriteAT(20,7,blue,lightgray,'Company =>');
- WriteAT(20,8,blue,lightgray,'Address =>');
- WriteAT(23,10,blue,lightgray,'City =>');
- WriteAT(48,10,blue,lightgray,'State');
- WriteAT(60,10,blue,lightgray,'Zip');
- WriteAT(23,12,blue,lightgray,'Phone =>');
- WriteAT(10,16,white,lightgray,'Instructions: [End to quit]');
- WriteAT(10,17,blue,lightgray,'This is a mock up of a data entry screen. Simply');
- WriteAT(10,18,blue,lightgray,'enter some values and press enter. Use the arrow');
- WriteAT(10,19,blue,lightgray,'keys to move between fields. Note the following:');
- WriteAT(10,20,white,lightgray,'End to finish entry Ins toggle insert on and off');
- WriteAT(10,21,white,lightgray,'Alt-D delete current field Alt-E delete all fields');
- WriteAT(10,22,white,lightgray,'Ctrl-Right shift right Ctrl-Left shift left');
- WriteAT(10,23,white,lightgray,'Tab shift right Shift-Tab shift left');
-
- IO_Edit(Code);
- IO_ResetFields;
- Clrscr;
- If Code <> 0 then
- WriteAT(1,1,white,black,'You escaped!')
- else
- begin
- WriteAT(1,1,lightgray,black,'Address: '+Str1);
- WriteAT(1,2,lightgray,black,' '+Str2);
- WriteAT(1,3,lightgray,black,' '+Str3);
- WriteAT(1,4,lightgray,black,' '+Str4);
- WriteAT(1,5,lightgray,black,'City: '+Str5);
- WriteAT(1,6,lightgray,black,'State: '+Str6);
- WriteAT(1,7,lightgray,black,'Zip: '+Str7);
- end;
- WriteAT(1,24,white,black,'Run DemoTTT.exe for the main demo program');
- WriteAT(1,25,white,black,'Technojocks Turbo Toolkit v4.0');
- Ch := Readkey;
- end.