home *** CD-ROM | disk | FTP | other *** search
- Unit InpDlgs;
- interface
-
- var stritem : array [1..10] of string;
-
- StrData: array [1..10] of record
- Title: string;
- InfoText: string;
- SDelka: byte;
- end;
- INResult: boolean;
-
- procedure ReadStrItems(SITitle, infotxt: string; delka: byte);
- procedure InputBox(x,y: byte; Title: string);
-
- implementation
- uses crt, okna, vstupy, savewind;
-
- var SICount: byte;
- Stbuf: pbuf;
-
- procedure ReadStrItems(SITitle, infotxt: string; delka: byte);
- begin
- SICount:=SICount+1;
- StrData[SICount].Title:=SITitle;
- StrData[SICount].InfoText:=Infotxt;
- StrData[SICount].SDelka:=Delka;
- end;
-
- procedure INul;
- begin
- SICount:=0;
- end;
-
- procedure InputBox(x, y: byte; Title: string);
- label 1;
- const IB_OK=1;
- IB_Opr=2;
- IB_Esc=3;
- var I,P,Q: byte;
- poms: string;
- BLast, BPos: byte;
- key: char;
- begin
- 1: P:=0;
- for I:=1 to SICount do
- begin
- Q:=Length(StrData[I].Title)+3+StrData[I].sdelka;
- if P<Q then P:=Q;
- end;
-
- poms:='';
- for I:=1 to P do poms:=poms+' ';
-
- for I:=1 to (SICount*2)-1 do WEReadLn(poms);
-
-
- WEReadBt(' OK ',IB_OK,'Potvrzení zadanÿch údajû...');
- WEReadBt(' Opravit ',IB_Opr,'Opravení zadanÿch údajû...');
- WEReadBt(' Zru¿it ',IB_Esc,'Anulování æádosti, akci neprovádêt...');
-
- WEWidthLn;
- BtDirect(x,y);
- WEButtonLnY:=y+(2*SICount);
-
- SaveWin(x-1,y-1,x+WEWidth,y+WECount+3,stbuf);
- WFrame(x,y,x+WEWidth-1,y+WECount+2);
-
- gotoxy(x+(WEWidth div 2)-(Length(Title) div 2)-1,y-1);
- textattr:=wcTitle;
- write(' ',Title,' ');
-
- for I:=1 to SICount do
- begin
- ShowLn(StrData[I].Title,x,y+(2*I)-2,StrData[I].sdelka);
- end;
-
- for I:=1 to BtCount do
- begin
- gotoxy(WEPosBt[I],WEButtonLnY);
- writebutton(Buttons[I].jmeno,btNoActive);
- end;
-
- for I:=1 to SICount do
- begin
- InputLnS(StrData[I].Title,StrData[I].infotext,x,y+(2*I)-2,StrData[I].sdelka,StrItem[I]);
- end;
-
- BLast:=1;
- BPos:=1;
- gotoxy(WEPosBt[Bpos],WEButtonLnY);
- writebutton(Buttons[BPos].jmeno,btActive);
- gotoxy(4,23);
- textattr:=wcText;
- write(infoln(Buttons[BPos].text));
- repeat
- key:=GetLegalKey([CR,ESC,TAB]);
- case key of
- TAB:
- begin
- BLast:=BPos;
- BPos:=BPos+1;
- if BPos=BtCount+1 then BPos:=1;
- end;
- end;
-
- gotoxy(WEPosBt[BLast],WEButtonLnY);
- writebutton(Buttons[BLast].jmeno,btNoActive);
- gotoxy(WEPosBt[BPos],WEButtonLnY);
- writebutton(Buttons[BPos].jmeno,btActive);
- textattr:=wcText;
- gotoxy(4,23);
- write(infoln(Buttons[BPos].text));
- until key in [CR,ESC];
-
- case key of
- CR:
- begin
- if Buttons[BPos].prikaz=IB_Opr then
- begin
- restorewin(x-1,y-1,x+WEWidth,y+WECount+3,stbuf);
- WENul;
- goto 1;
- end;
- if Buttons[Bpos].prikaz=IB_Esc then
- begin
- restorewin(x-1,y-1,x+WEWidth,y+WECount+3,stbuf);
- WENul;
- INul;
- INResult:=false;
- exit;
- end;
- if Buttons[BPos].prikaz=IB_OK then
- begin
- restorewin(x-1,y-1,x+WEWidth,y+WECount+3,stbuf);
- WENul;
- INul;
- INResult:=true;
- end;
- end;
- ESC:
- begin
- restorewin(x-1,y-1,x+WEWidth,y+WECount+3,stbuf);
- WENul;
- INul;
- INResult:=false;
- exit;
- end;
- end;
- end;
-
-
- BEGIN
- SICount:=0;
- END.
-