home *** CD-ROM | disk | FTP | other *** search
- {$A-,B-,E+,F+,I+,N-,O+,R+,S+,V-}
- {$M 32000,64000,655360}
-
- { Test Program for testing ULDial }
-
- Program TESTDIAL;
-
- Uses ULRoot, DOS, OpCrt, OpString, OpKey, OpFrame, OpWindow,
- ULDial;
-
- label
- Again;
-
- var
- Msg : string;
- Choices : string;
- Prompt : string;
- Len : byte absolute Prompt;
- EditSt : string;
- ExitCode : word;
- TimeOut : word;
- N : longint;
- Dial : DialogBox;
- Error : word;
- Orientation : HorizVerticalType;
- NrRows, NrCols : byte;
-
- begin
- N := MemAvail;
- InitCrt;
- with ULRootColorSet do
- TextAttr := ColorMono(HotSpotColor, HotSpotMono);
- Again:
- ClrScr;
- WriteLn('Test of DialogBox.');
- WriteLn('Do you want radio buttons arranged horizontally or vertically?');
- Write('Enter H or V═');
- ReadLn(Msg);
- NrRows := 1;
- NrCols := 1;
- if UpCase(Msg[1]) = 'H' then
- begin
- Orientation := rbHoriz;
- Write('How many rows of buttons? ═');
- ReadLn(NrRows);
- end
- else
- begin
- Orientation := rbVertical;
- Write('How many columns of buttons? ═');
- ReadLn(NrCols);
- end;
- if not Dial.InitDeluxe(0,0,DefWindowOptions+wBordered,
- ULRootColorSet, Orientation,
- NrRows, NrCols, False, 4,320,8,80) then Halt;
- WriteLn('Enter lines of text that you want used for message.');
- WriteLn('Use blank line to end.');
- EditSt := '';
- with Dial do
- begin
- AddHeader(' DialogBox ',heTC);
- repeat
- Write('═');
- ReadLn(Msg);
- if Msg <> '' then AddMessageString(Msg);
- until Msg = '';
- WriteLn('Enter several choices you want displayed as radio buttons.');
- WriteLn('Enter blank line to end the choices.');
- repeat
- Write('═');
- ReadLn(Choices);
- if Choices <> '' then AddChoice(Choices);
- until Choices = '';
- WriteLn('If you want a string entry field, enter a 2 or 3 word prompt.');
- WriteLn('If you do not want an entry field, enter a blank line.');
- Write('═');
- ReadLn(Prompt);
- if Prompt <> '' then
- AddStringEntryField(Prompt,1,1,CharStr('X',80),1,
- Len+2,20,0,EditSt);
- WriteLn('If you want an automatic timeout, enter number of seconds delay.');
- WriteLn('Enter 0 to disable this function.');
- ReadLn(TimeOut);
- SetTimeOut(TimeOut);
- Error := GetLastError;
- if Error <> 0 then
- begin
- WriteLn('Error: ', Error);
- Halt(1);
- end;
- Process;
- ExitCode := GetLastChoice;
- EditSt := GetEditedString;
- Done;
- end;
- WriteLn('You exited with code: ',ExitCode);
- if Prompt <> '' then
- WriteLn('The edited string was: ', EditSt);
- WriteLn('Press {Enter} to go again; any other key to quit...');
- ExitCode := ReadKeyWord;
- if ExitCode = Enter then Goto Again;
- wStack.Done; { If you don't use this, you eat up 40 bytes of the heap.}
- RestoreCrt;
- WriteLn('Memory Available: Start:', N);
- WriteLn(' Finish:',MemAvail);
- end.