Скачиваний:
124
Добавлен:
08.05.2014
Размер:
3 Кб
Скачать
{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 initdialog:pdialog;
virtual;
end;

var file_data:text;
intface:global;
get_dlg_result:record
listptr:pcollection;
number_in_lst:word;
end;

constructor global.init;
var get_str:string;

begin
inherited init;
assign(file_data,'hwpc.txt');
{$I-}
reset(file_data);
if ioresult<>0 then begin
messagebox(#3+'” ©« б Ёб室­л¬Ё ¤ ­­л¬Ё ­Ґ ­ ©¤Ґ­! ђ Ў®в  Їа®Ја ¬¬л ­Ґў®§¬®¦­ .',nil,mferror+mfokbutton);
halt;
end;
{$I+}
get_dlg_result.listptr:=new(pcollection,init(50,10));
while not eof(file_data) do begin
readln(file_data,get_str);
with get_dlg_result.listptr^ do insert(newstr(get_str));
end;
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;

procedure global.handleevent(var event: tevent);

begin
inherited handleevent(event);
if event.what<>evcommand then exit;
case event.command of
100: begin
if executedialog(initdialog,@get_dlg_result)<>cmok then exit;
end;
101: begin
with get_dlg_result.listptr^ do atdelete(get_dlg_result.number_in_lst);
end;
end;
clearevent(event);
end;

function global.initdialog:pdialog;
var r:trect;
dlg:pdialog;
scrollbar:pscrollbar;
lbox:plistbox;
pole:pview;
button:pbutton;

begin
r.assign(1,1,68,19);
new(dlg, init(r,'Џа®б¬®ва'));
with dlg^ do begin
options:=options xor ofcentered;
r.assign(64,4,65,12);
new(scrollbar,Init(r));
insert(scrollbar);
r.assign(2,4,64,12);
pole:=new(plistbox,init(r,1,scrollbar));
lbox:=plistbox(pole);
insert(pole);
r.assign(5,2,34,3);
insert(new(plabel,init(r,'ђл­®Є Љ®ЇмовҐа®ў',pole)));
r.assign(1,14,11,16);
button:= new(pbutton,init(R,'O~K~',cmok,bfdefault));
button^.options:=button^.options or ofcenterx;
insert(button);
end;
selectnext(false);
initdialog:=dlg;
end;

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