Скачиваний:
129
Добавлен:
08.05.2014
Размер:
4.09 Кб
Скачать
{code by jets@mail.ru, 2000 year}
uses app,objects,menus,drivers,views,dialogs,msgbox;

type global=object(tapplication)
constructor init;
procedure initstatusline;
virtual;
procedure initmenubar;
virtual;
procedure handleevent(var event:tevent);
virtual;
function get_param(whats_do:word):pdialog;
virtual;
end;

var file_data:text;
intface:global;
whats_select:word;

constructor global.init;
begin
inherited init;
assign(file_data,'notebk.txt');
{$I-}
reset(file_data);
if ioresult<>0 then begin
messagebox(#3+'” ©« б Ёб室­л¬Ё ¤ ­­л¬Ё ­Ґ ­ ©¤Ґ­! ђ Ў®в  Їа®Ја ¬¬л ­Ґў®§¬®¦­ .',nil,mferror+mfokbutton);
halt;
end;
{$I+}
close(file_data);
end;

procedure global.initstatusline;
var r:trect;
begin
getextent(r);
r.a.y:=r.b.y-1;
new(statusline,init(r,newstatusdef(0,$EFFF,
newstatuskey('~Alt-X~ ‚л室', kbaltx, cmquit,
newstatuskey('~F10~ ЊҐ­о', kbF10, cmmenu,
nil)),nil)));
end;

procedure global.initmenubar;
var r:trect;
begin
getextent(r);
r.b.y:=r.a.y+1;
menubar:=new(pmenubar,init(r,newmenu(
newitem('~Ћ~ЎкҐ¬ Ћ‡“','F1',kbF1,100,hcnocontext,
newitem('Ћ~Ў~ꥬ Ќ†Њ„','F2',kbF2,101,hcnocontext,
nil)))));
end;

function global.get_param(whats_do:word):pdialog;
var r:trect;
dlg:pdialog;
checkbut:pcluster;
button:pbutton;

begin
r.assign(1,1,38,14);
new(dlg, init(r,'‚лЎ®а'));
with dlg^ do begin
options:=options xor ofcentered;
if whats_do=100 then begin
r.assign(15,3,29,5);
checkbut:=new(pradiobuttons,init(r,
newsitem('~4~ ¬Ў ©в ',
newsitem('~2~ ¬Ў ©в ',nil))));
insert(checkbut);
r.assign(3,3,14,4);
insert(new(plabel, init(r,'ЋЎкҐ¬ Ћ‡“:',checkbut)));
end
else begin
r.assign(16,3,32,9);
checkbut:=new(pradiobuttons,init(r,
newsitem('~3~0 ¬Ў ©в',
newsitem('~8~0 ¬Ў ©в',
newsitem('~1~20 ¬Ў ©в',
newsitem('13~5~ ¬Ў ©в',
newsitem('~2~00 ¬Ў ©в',
newsitem('2~4~0 ¬Ў ©в',nil))))))));
insert(checkbut);
r.assign(3,3,15,4);
insert(new(plabel, init(r,'ЋЎкҐ¬ Ќ†Њ„:',checkbut)));
end;
r.assign(1,10,11,12);
button:= new(pbutton,init(R,'O~K~',cmok,bfdefault));
button^.options:=button^.options or ofcenterx;
insert(button);
end;
selectnext(false);
get_param:=dlg;
end;


procedure global.handleevent(var event: tevent);
const ozu:array[0..1] of char=('4','2');
mgz:array[0..5] of string[3]=(' 30',' 80','120','135','200','240');
var chast,best_chast:byte;
error:integer;
get_str,best_pc:string;
flag:boolean;
r:trect;

begin
inherited handleevent(event);
if event.what<>evcommand then exit;
case event.command of
100: if executedialog(get_param(event.command),@whats_select)<>cmok then exit;
101: if executedialog(get_param(event.command),@whats_select)<>cmok then exit;
end;
best_chast:=0;
reset(file_data);
for error:=1 to 5 do readln(file_data);
while not eof(file_data) do begin
readln(file_data,get_str);
val(copy(get_str,22,2),chast,error);
if event.command=100 then begin
if (copy(get_str,31,1)=ozu[whats_select]) and (chast>best_chast) then begin
best_pc:=get_str;
best_chast:=chast;
end;
end
else begin
if (copy(get_str,36,3)=mgz[whats_select]) and (chast>best_chast) then begin
best_pc:=get_str;
best_chast:=chast;
end;
end;
end;
close(file_data);
r.assign(1,1,72,10);
messageboxrect(r,' ”Ёа¬  ’ЁЇ — бв®в  ЋЎкҐ¬ ЋЎкҐ¬ Љ-ў® Њ®­Ёв®а –Ґ­ '+#13+best_pc,nil,mfinformation+mfokbutton);
end;

begin
intface.init;
intface.run;
intface.done;
end.
Соседние файлы в папке задание №7 — 9