IPB
ЛогинПароль:

> Прочтите прежде чем задавать вопрос!

1. Заголовок темы должен быть информативным. В противном случае тема удаляется ...
2. Все тексты программ должны помещаться в теги [code=pas] ... [/code], либо быть опубликованы на нашем PasteBin в режиме вечного хранения.
3. Прежде чем задавать вопрос, см. "FAQ", если там не нашли ответа, воспользуйтесь ПОИСКОМ, возможно такую задачу уже решали!
4. Не предлагайте свои решения на других языках, кроме Паскаля (исключение - только с согласия модератора).
5. НЕ используйте форум для личного общения, все что не относится к обсуждению темы - на PM!
6. Одна тема - один вопрос (задача)
7. Проверяйте программы перед тем, как разместить их на форуме!!!
8. Спрашивайте и отвечайте четко и по существу!!!

 
 Ответить  Открыть новую тему 
> Turbo Vision, Сортировка записей в Turbo Vision...
сообщение
Сообщение #1


Гость






- Помогите пожалуйста с сортировкой в Turbo Vision! Задание у меня, чтоб сортировало украинские символы "і", "ї", "є" в нужном порядке, а не в начале или конце...
- И еще, чтобы производился поиск, по полям где числа, в диапазоне...
ПОЖАЛУЙСТА помогите... кто знает как это сделать!!!

Вот прога (модуль), если поможет...


unit FX;
{---------------------------------------------------------------------------}
INTERFACE
{---------------------------------------------------------------------------}
uses App,CRT,Objects,Menus,Drivers,Views,StdDlg,DOS,Memory,Dialogs,MsgBox,colorsel;
{---------------------------------------------------------------------------}
type {ЋЎуЄв TWorkWin бвў®аоу а ¬Є®ўҐ ўiЄ­® § Ї®«®бЄ ¬Ё бЄа®«i­Ј  ¤«п
гЇа ў«i­­п ўЎг¤®ў ­Ё¬ ў ­м®Ј® ®ЎуЄв®¬ TInterior}
PWorkWin=^TWorkWin;
TWorkWin=object(TWindow)
Constructor Init(Bounds:Trect);
end;
{---------------------------------------------------------------------------}
{ЋЎуЄв TDlgwin бвў®аоу ¤i «®Ј®ўҐ ўiЄ­® ¤«п ўЁЎ®аг ०Ё¬  а®Ў®вЁ}
PDlgWin=^TDlgWin;
TDlgWin=object(TDialog)
Procedure HandleEvent(var Event:TEvent);Virtual;
end;
{---------------------------------------------------------------------------}
{Ќ бвгЇ­Ё© ®ЎуЄв ®Ўб«гЈ®ўгу ў­гваiи­о з бвЁ­г а ¬Є®ў®Ј® ўiЄ­  TWorkWin.
‚i­ бвў®аоу бЄа®«о ўiЄ­® § § ЇЁб ¬Ё §  аеiў­®Ј® д ©«  i § ¤®Ї®¬®Ј®о
¤i «®Ј®ў®Ј® ўiЄ­  TDlgWin гЇа ў«пу а®Ў®в®о § жЁ¬Ё § ЇЁб ¬Ё}
PInterior=^TInterior;
TInterior=object(TScroller)
PS:PStringCollection;
Location:Word;
Constructor Init(var Bounds:Trect;HS,VS:PscrollBar);
Procedure Draw;Virtual;
Procedure ReadFile;
Destructor Done;Virtual;
Procedure HandleEvent(var Event:TEvent);Virtual;
end;
{---------------------------------------------------------------------------}
Tbook=object(TApplication){бвў®аоу ®ЎуЄв-­ й ¤®Є ўi¤ TApplication}
{---------------------------------------------------------------------------}
Procedure InitMenuBar;Virtual;{ЏҐаҐЄаЁў у бв ­¤ ав­Ё© ¬Ґв®¤ InitMenuBar}
Procedure InitStatusLine;Virtual;{ЏҐаҐЄаЁў у¬ бв аЁ© ¬Ґв®¤ InitStatusLine ­®ўЁ¬}
Procedure HandleEvent(var Event:TEvent);Virtual;
Procedure AvtorA;
Procedure AvtorV;
Procedure FileSave;
Procedure ChangeDir;
Procedure ShallDOS;
Procedure FileOpen;
Procedure Work;
Procedure Idle;Virtual;
Constructor Init;
end;
{---------------------------------------------------------------------------}
const
{---------------------------------------------------------------------------}
cmHelp=201;
cmChDir=202;
cmWork=203;
cmDOS=204;
cmCan=205;
cmDelete=206;
cmSearch=207;
cmEdit=208;
cmAdd=209;
cmAvtorA=210;
cmAvtorV=211;
cmSearchnazva=212;
cmSearchmarka=213;
cmSearchrik=214;
cmSearchobem=215;
cmSearchcolir=216;
cmSearchcina=217;
cmSearchAll=218;

WinCom1:TCommandSet=[cmSave,cmWork];
WinCom2:TCommandSet=[cmOpen];

Lnazva=20;
Lmarka=16;
Lrik=11;
Lobem=10;
Lcolir=12;
Lcina=8;
LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
{---------------------------------------------------------------------------}
type autopark=record
nazva:string[Lnazva];
marka:string[Lmarka];
rik:string[Lrik];
obem:string[Lobem];
colir:string[Lcolir];
cina:string[Lcina];
end;
{---------------------------------------------------------------------------}
var {auto:autopark}i:integer;
f:file of autopark;{” ©«®ў  §¬i­­ }
Openf:Boolean;
Posh,Poz:array[1..200] of autopark;
{---------------------------------------------------------------------------}
IMPLEMENTATION
{---------------------------------------------------------------------------}
Constructor Tbook.init;
{---------------------------------------------------------------------------}
var i:integer;
begin
for i:=1 to 63 do
case i of
1:getpalette^[1]:=#$7e; {‚iЄ­® § ­Ґўi¤ЄаЁвЁ¬ д ©«®¬}
2:getpalette^[2]:=#$10f; {ЌЁ¦­п в  ўҐае­п Ї ­Ґ«м}
3:getpalette^[3]:=#$10f; {’ҐЄбв ­Ґ¤®бвгЇ­Ёе Їг­Євiў ¬Ґ­о}
4:getpalette^[4]:=#$10e; {Љ« ўiиi Ўi«п Є®¬ ­¤}
5:getpalette^[5]:=#$10e; {‚Ё¤i«Ґ­i Є­®ЇЄЁ}
6:getpalette^[6]:=#$10f; {ЏаЁ ­ вЁбЄ ­­i ­  ­Ґ¤®бвгЇ­г Є­®ЇЄг}
7:getpalette^[7]:=#$8e; {‘Ё¬ў®« Ўi«п ўЁ¤i«Ґ­Ёе Є­®Ї®Є}
9:getpalette^[9]:=#$10e; {ђ ¬Є  § д ©« }
10:getpalette^[10]:=#$10f; {„Ґв «i а ¬ЄЁ}
11:getpalette^[11]:=#$10f; {Џ®«®бЁ Їа®ЄагвЄЁ}
12:getpalette^[12]:=#$10e; {‘ваi«ЄЁ Їа®ЄагвЄЁ}
13:getpalette^[13]:=#$10f; {”®­ i ⥪бв а®Ў®з®х ®Ў« бвi}
14:getpalette^[14]:=#$10e; {”®­ i ⥪бв ўЁ¤i«Ґ­®Ј® § ЇЁбг}
33:getpalette^[33]:=#$10e; {ђ ¬Є  ¤i «®Ј®ў®Ј® ўiЄ­ }
34:getpalette^[34]:=#$10f; {ЇаЁ ­ вЁбЄ ­­i ­  ўiЄ­®}
35:getpalette^[35]:=#$10f; {Џ®«®бЁ Їа®ЄагвЄЁ ¤i «®Ј®ў®Ј® ўiЄ­ }
36:getpalette^[36]:=#$10e; {‘ваi«ЄЁ Їа®ЄагвЄЁ ¤i «®Ј®ў®Ј® ўiЄ­ }
37:getpalette^[37]:=#$10e; {”®­ ¬Ґ­о}
38:getpalette^[38]:=#$10f; {ЌҐ ЄвЁў­i ­ §ўЁ}
39:getpalette^[39]:=#$10e; {ЂЄвЁў­i ­ §ўЁ}
40:getpalette^[40]:=#$10e;
41:getpalette^[41]:=#$6f; {Љ­®ЇЄ }
42:getpalette^[42]:=#$6f; {Љ­®ЇЄ }
43:getpalette^[43]:=#$6e; {ЂЄвЁў­  Є­®ЇЄ }
44:getpalette^[44]:=#$8f;
45:getpalette^[45]:=#$6e;
46:getpalette^[46]:=#$10e; {‡ ¤­пп з бвм Є­®ЇЄЁ}
50:getpalette^[50]:=#$6e; {Џ®«Ґ ўўҐ¤Ґ­­п}
51:getpalette^[51]:=#$6f; {— бвЁ­  Ї®«п ўўҐ¤Ґ­­п}
52:getpalette^[52]:=#$6f;
53:getpalette^[53]:=#$10f; {‘ваi«Є }
54:getpalette^[54]:=#$10e; {Џ®«®бЁ Ўi«п бваi«ЄЁ}
55:getpalette^[55]:=#$10f; {Џ®«®бЁ Їа®ЄагвЄЁ ўiЄ®­жп}
56:getpalette^[56]:=#$10e; {‘ваi«ЄЁ Їа®ЄагвЄЁ}
57:getpalette^[57]:=#$6f; {”®­ ¬Ґ­о д ©«iў}
58:getpalette^[58]:=#$6e; {ЂЄвiў­  Є­®ЇЄ }
59:getpalette^[59]:=#$6f; {ЌҐ ЄвЁў­  Є­®ЇЄ }
60:getpalette^[60]:=#$0e; {ЏҐаҐЈ®а®¤Є }
61:getpalette^[61]:=#$6e;
end;
inherited init;
end;
{---------------------------------------------------------------------------}
Constructor TworkWin.Init(Bounds:Trect);
{---------------------------------------------------------------------------}
{‘⢮७­п ўiЄ­  ¤ ­Ёе}
var HS,VS:PScrollBar;{Џ®«®бЁ ўЄ §iў­ЁЄЁ}
Interior:PInterior;{‚Є §iў­ЁЄ ­  ЄҐагу¬Ґ вҐЄбв®ўҐ ўiЄ­®}
begin
Twindow.Init(Bounds,'‚ЁЎҐаiвм Ї®ваiЎ­Ё© § ЇЁб. ESC - ЇҐаҐеi¤ ¤® ¤i «®Јг',0); {‘вў®аоу¬ ­®ўҐ ўiЄ­® § а ¬Є®о}
GetClipRect(Bounds);{ЋваЁ¬гу¬® ў Bounds Є®®а¤Ё­ вЁ ¬i­i¬ «м­®х
ЇҐаҐ¬ «м®ўгу¬®х з бвЁ­Ё ўiЄ­ }
Bounds.Grow(-1,-1);{‚бв ­®ў«оу¬® а®§¬iаЁ ўiЄ­  § ⥪б⮬}
{‚¬ЁЄ у¬® бв ­¤ ав­i Ї® ஧¬iаг i Ї®«®¦Ґ­­о Ї®«®бЁ-ўЄ §iў­ЁЄЁ}
VS:=StandardScrollBar(sbVertical+sbHandleKeyBoard);
HS:=StandardScrollBar(sbHorizontal+sbHandleKeyBoard);
{‘вў®аоу¬ ⥪бв®ўҐ ўiЄ­®:}
Interior:=New(PInterior,Init(Bounds,HS,VS));
Insert(Interior);{‚Є«оз у¬ ©®Ј® ў ®б­®ў­Ґ ўiЄ­®}
end;
{---------------------------------------------------------------------------}
Procedure TDlgWin.HandleEvent;
{---------------------------------------------------------------------------}
begin
Inherited HandleEvent(Event);
if Event.What=evCommand then EndModal(Event.Command);
end;
{---------------------------------------------------------------------------}
Procedure Tbook.FileOpen;
{---------------------------------------------------------------------------}
{‚i¤ЄаЁў у д ©« ¤ ­Ёе}
var PF:PFileDialog;{„i «®Ј®ўҐ ўiЄ­® ўЁЎ®аг д ©« }
Control:word;
s:PathStr;
begin
{‘вў®аоу¬® ҐЄ§Ґ¬Ї«па ¤Ё­ ¬iз­®Ј® ®ЎуЄв :}
New(PF,Init('*.dat','‚ЁЎҐаiвм Ї®ваiЎ­Ё© д ©«:','I¬"п д ©« ',fdOpenButton,0));
{‡  ¤®Ї®¬®Ј®о ­ бвгЇ­®Ј® ®ЇҐа в®а  ўiЄ­® ўЁў®¤Ёвмбп ­  ҐЄа ­
i १г«мв в а®Ў®вЁ ЄаЁбвгў з  § ­Ё¬ Ї®¬iй увмбп ў §¬i­­г Control:}
Control:=DeskTop^.ExecView(PF);
{Ђ­ «i§гу¬® аҐ§г«мв в § ЇЁвг:}
case Control of StdDlg.cmFileOpen,cmOk:
begin {Љ®аЁбвгў з ўЄ §гу i¬п д ©« :}
PF^.GetFileName(s);{s ¬iбвЁвм i¬п д ©« :}
Assign(f,s); {ўi¤ЄаЁвЁ д ©«}
{$I-}
Reset(f);
if IoResult<>0 then
Rewrite(f);
Openf:=IoResult=0;
{$I+}
if Openf then
Begin
DisableCommands(WinCom2);
EnableCommands(WinCom1);
Work;{ЏҐаҐе®¤Ё¬® ¤® а®Ў®вЁ}
end;
end;
end;
Dispose(PF,Done) {‡­Ёйгу ҐЄ§Ґ¬Ї«па}
end;
{---------------------------------------------------------------------------}
Procedure Tbook.FileSave;
{---------------------------------------------------------------------------}
begin
Close(f);
Openf:=False;
EnableCommands(WinCom2);
DisableCommands(WinCom1);
end;
{---------------------------------------------------------------------------}
Procedure Tbook.ChangeDir;
{---------------------------------------------------------------------------}
var PD:PChDirDialog;{„i «®Ј®ўҐ ўiЄ­® §¬i­Ё Є в «®Ј }
Control:Word;
begin
New(Pd,Init(cdNormal,0)); {бвў®аоу¬ ¤i «®Ј®ўҐ ўiЄ­®}
Control:=DeskTop^.ExecView(PD); {‚ЁЄ®аЁбв®ўгу¬ ўiЄ­®}
Chdir(PD^.DirInput^.data^); {‚бв ­®ў«оу¬® ­®ўЁ© Є в «®Ј}
Dispose(PD,Done) {‚Ё¤ «пу¬® ўiЄ­® § Єгзi}
end;
{---------------------------------------------------------------------------}
Procedure Tbook.ShallDOS;
{---------------------------------------------------------------------------}
const txt='„«п Ї®ўҐа­Ґ­­п ўўҐ¤iвм EXIT ў ўi¤Ї®ўi¤м'+' ­  § ЇЁв DOS...';
begin
DoneEvents; {‡ ЄаЁў у ®Ўа®Ў«оў з Ї®¤i©}
DoneVideo; {‡ ЄаЁвЁ ¬®­iв®а ҐЄа ­ }
DoneMemory; {‡ ЄаЁвЁ ¬®­iв®а Ї ¬пвi}
SetMemTop(HeapPtr); {‡ўi«м­ЁвЁ Єгзг}
Writeln(txt); {ЋЇ®ўiбвЁвЁ Їа® ўЁеi¤}
SwapVectors; {‚бв ­®ўЁвЁ бв ­¤ ав­i ўҐЄв®аЁ}
{ЏҐаҐ¤ вЁ гЇа ў«i­­п Є®¬ ­¤­®¬г Їа®жҐб®аг DOS:}
Exec(GetEnv('COMSPEC'),'');
{Џ®ўҐа­гвЁбп § DOS:}
SwapVectors; {Џ®­®ўЁвЁ ўҐЄв®аЁ}
SetMemTop(HeapEnd); {Џ®­®ўЁвЁ Єгзг}
InitMemory; {‚i¤ЄаЁвЁ ¬®­iв®а Ї ¬пвi}
InitVideo; {‚i¤ЄаЁвЁ ¬®­iв®а ҐЄа ­ }
Initevents; {‚i¤ЄаЁвЁ ®Ўа®Ў«оў з Ї®¤i©}
InitSysError; {‚i¤ЄаЁвЁ ®Ўа®Ў«оў з Ї®¬Ё«®Є}
Redraw {Џ®­®ўЁвЁ ўЁ¤ ҐЄа ­ }
end;
{---------------------------------------------------------------------------}
Procedure Tbook.AvtorA;
{---------------------------------------------------------------------------}
const txt:array [0..1] of string[40]=(
' ‚ЁЄ®­ ў:бв㤥­в ЈагЇЁ ЂЉ‘ 1-7 ',
' ђгбб Є®ўбмЄЁ© „¬Ёва® Ћ«ҐЄб ­¤а®ўЁз ');
var r:TRect;{§ ¤ ­­п Є®®а¤Ё­ в ЇаאַЄгв­.¤i«п­ЄЁ ҐЄа ­ ,¤«п ஧в.Avtor}
d:PDLgWin;
i:integer;
Control:Word;
begin
r.assign(24,10,63,14);
d:=New(PDlgWin,Init(R,' Ђўв®а Їа®Ја ¬Ё: '));
with d^ do
for i:=0 to 1 do
begin
r.Assign(1,1+i,38,2+i);
Insert(New(PStaticText,Init(R,#3+Txt[i])));
end;
DeskTop^.ExecView(d);
end;
{---------------------------------------------------------------------------}
Procedure Tbook.AvtorV;
{---------------------------------------------------------------------------}
const txt:array [0..1] of string[40]=(
' ЏҐаҐўiаЁў ўЁЄ« ¤ з: ',
' Ѓа®ўзҐ­Є® Ќ в «iп ЌҐбв®аiў­  ');
var r:TRect;{§ ¤ ­­п Є®®а¤Ё­ в ЇаאַЄгв­.¤i«п­ЄЁ ҐЄа ­ ,¤«п ஧в.Avtor}
d:PDLgWin;
i:integer;
Control:Word;
begin
r.assign(24,10,63,14);
d:=New(PDlgWin,Init(R,' ‚ЁЄ« ¤ з: '));
with d^ do
for i:=0 to 1 do
begin
r.Assign(1,1+i,38,2+i);
Insert(New(PStaticText,Init(R,#3+Txt[i])));
end;
DeskTop^.ExecView(d);
end;
{---------------------------------------------------------------------------}
Procedure Tbook.Idle;{Ј®¤Ё­­ЁЄ,¤ в }
{---------------------------------------------------------------------------}
const Old:byte=0;
Dt=1;
days:array [0..6] of String[9]=('ЌҐ¤.','Џ®­','‚iўв.','‘Ґа',
'—Ґвў.','Џпв­.','‘гЎ.');
var Ho,Mi,Se,S100:word;
y,m,d,dow,xx,yy:Word;
Function timestr(K:word):string;
var Ss:string[2];
begin
Str(K,Ss);
if K<10 then Ss:='0'+Ss;
Timestr:=Ss
end;
begin
xx:=wherex;
yy:=wherey;
gettime(ho,mi,se,s100);
if (se mod dt=0) and (old<>se) then
begin
old:=se;
textcolor(white);
textbackground(8);
gotoxy(72,1);{஧в игў ­­п з бг ­  ҐЄа ­i}
write(timestr(ho)+':'+timestr(mi)+':'+timestr(se));
end;
GetDate(y,m,d,dow);
GotoXY(50,1);
Writeln('',days[dow],',',d:0,'/',m:0,'/',y:0);
gotoXY(xx,yy);
end;
{---------------------------------------------------------------------------}
Constructor TInterior.Init(var Bounds:Trect;HS,VS:PScrollBar);
{---------------------------------------------------------------------------}
{‘вў®аоу ўiЄ­® бЄа®«Ґа }
begin
Inherited Init(Bounds,HS,VS);
ReadFile;
GrowMode:=gfGrowHiX+gfGrowHiY;
SetLimit(LLine,PS^.Count);
end;
{---------------------------------------------------------------------------}
Destructor TInterior.Done;
{---------------------------------------------------------------------------}
begin
Dispose(PS,Done);
Inherited Done;
end;
{---------------------------------------------------------------------------}
Procedure TInterior.ReadFile;
{---------------------------------------------------------------------------}
var k:integer;
s,shapka:String;
data:autopark;
t:text;
begin
PS:=New(PStringCollection,Init(100,10));
seek(f,0);
shapka:=' Ќ §ў  | Њ аЄ  | ђiЄ | ЋЎ"Ґ¬ | Љ®«iа | –i­  ';
PS^.insert(NewStr(shapka));
while not (EOF(f) or LowMemory) do
begin
read(f,data);
with data do
begin
s:=nazva;
while Length(s)<Lnazva do s:=s+' ';
s:=s+marka;
while Length(s)<Lnazva+Lmarka do s:=s+' ';
s:=s+rik;
while Length(s)<Lnazva+Lmarka+Lrik do s:=s+' ';
s:=s+obem;
while Length(s)<Lnazva+Lmarka+Lrik+Lobem do s:=s+' ';
s:=s+colir;
while Length(s)<Lnazva+Lmarka+Lrik+Lobem+Lcolir do s:=s+' ';
s:=s+cina;
end;
if s<>' ' then PS^.Insert(NewStr(S));
end;
Location:=0;
end;
{---------------------------------------------------------------------------}
Procedure TInterior.Draw;
{---------------------------------------------------------------------------}
{‚Ёў®¤Ёвм ¤ ­i ў ўiЄ­® ЇҐаҐЈ«п¤г}
var n{Ї®в®з­  бва®Є  ҐЄа ­ },k:integer;{Ї®в®з­  бва®Є  ¬ бЁў }
B:TDrawBuffer;
Color:Byte;
p:PString;
begin
if Delta.Y>Location then Location:=Delta.Y;
if Location>Delta.Y+pred(Size.Y) then Location:=Delta.Y+Pred(Size.Y);
for n:=0 to pred(Size.Y) do
{Size.Y - Љi«мЄiбвм бва®Є ўiЄ­ }
begin
k:=Delta.Y+n;
if k=Location then Color:=GetColor(2)
else Color:=GetColor(1);
MoveChar(B,' ',Color,Size.X);
if k<pred(PS^.Count) then
begin
p:=PS^.At(k);
MoveStr(B,Copy(p^,Delta.X,size.X),Color);
end;
WriteLine(0,N,Size.X,1,B)
end;
EnableCommands(WinCom1);
end;
{---------------------------------------------------------------------------}
Function Control:Word;
{---------------------------------------------------------------------------}
{ЋваЁ¬гу Є®¬ ­¤г i§ ®б­®ў­®Ј® ¤Ё «®Ј®ў®Ј® ўiЄ­ }
const L=2;
Dy=2;
But:array [0..4] of string[20]={Ќ ЇЁбЁ ­  Є­®ЇЄ е}
('~1~ ‚Ёеi¤','~2~ ‡­ЁйЁвЁ','~3~ ‡­ ©вЁ','~4~ ‡¬i­ЁвЁ','~5~ „®Ў ўЁвЁ');
var R:TRect;
D:PDlgWin;
k:Integer;
Begin
R.Assign(42,3,69,16);
D:=New(PDlgWin,Init(R,'ЊҐ­о:'));
with D^ do
begin
for k:=0 to 4 do
begin
R.Assign(1,2+k*Dy,25,2+k*Dy+L);
Insert(New(PButton,
Init(R,But[k],cmCan+k,bfNormal)));
end;
SelectNext(False);{ЂЄвЁўгу¬® ЇҐаиг Є­®ЇЄг}
end;
Control:=DeskTop^.ExecView(D);{‡¤i©б­оу¬® ¤i «®Ј}
end;
{---------------------------------------------------------------------------}
Function Poshuk:Word;
{---------------------------------------------------------------------------}
const L=2;
Dy=2;
But:array[0..6] of String[20]={­ ЇЁб ­  Є­®ЇЄ е}
('~1~ ‡  ­ §ў®о ' ,'~2~ ‡  ¬ аЄ®о' , '~3~ ‡  а®Є®¬ ',
'~4~ ‡  ®Ў"н¬®¬','~5~ ‡  Є®«м®а®¬','~6~ ‡  жi­®о','~7~ ‡ Ј «м­Ё© ');
var R:TRect;
D:PDlgWin;
k:Integer;
begin
R.Assign(42,3,69,20);
D:=New(PDlgWin,Init(R,'ЊҐ­о Ї®игЄ:'));
with D^ do
begin
for k:=0 to 6 do
begin{ўбв ў«пу¬® Є­®ЇЄЁ}
R.Assign(1,2+k*Dy,25,2+k*Dy+L);
Insert(New(PButton,Init(R,But[k],cmSearchnazva+k,bfNormal)));
end;
SelectNext(False);{ ЄвЁўгу¬® ЇҐаиг Є­®ЇЄг}
end;
Poshuk:=DeskTop^.ExecView(D);{ўЁЄ®­гу¬® ¤i «®Ј}
end;
{---------------------------------------------------------------------------}
Procedure TInterior.HandleEvent;
{---------------------------------------------------------------------------}
Procedure DeleteItem;
{---------------------------------------------------------------------------}
var D:integer;
PStr:Pstring;
s:String;
data:autopark;
begin
PStr:=PS^.At(Location);{ЋваЁ¬гу¬® Ї®з­Ё© § ЇЁб}
s:=copy(Pstr^,1,Lnazva);
seek(f,0);
D:=-1; {D - Ќ®¬Ґа § ЇЁб  ў д ©«i}
repeat {–ЁЄ« Ї®игЄг Ї® бЇiўЇ ¤ ­­о Ї®«п Priz:}
inc(D);
read(f,data);
with data do while Length(nazva)<Lnazva do nazva:=nazva+' '
until data.nazva=s;
seek(f,pred(FileSize(f)));
read(f,data); {зЁв у¬® ®бв ­­i© § ЇЁб}
seek(f,D);
write(f,data); {Џ®¬iй у¬® хх ­  ¬iбжҐ ўЁ¤ «пу¬®х}
seek(f,pred(FileSize(f)));
truncate(f); {‚Ё¤ «пу¬® ®бв ­­i© § ЇЁб}
with PS^ do D:=IndexOf(At(Location));
PS^.AtFree(D); {‚Ё¤ «пу¬ бва®Єг § Є®«ҐЄжiх}
Draw; {ЋЎ­®ў«пу¬® ўiЄ­®}
end;
{---------------------------------------------------------------------------}
Procedure AddItem(Edit:Boolean);
{---------------------------------------------------------------------------}
const y=1;
dy=2;
LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
var data:autopark;
R:TRect;
InWin:PDialog;
Bnazva,Bmarka,Brik,Bobem,Bcolir,Bcina:PInputLine;
Control:Word;
OldCount:Word;
s:String;
p:PString;
begin
Seek(f,fileSize(f));{„®Ў ў«пу¬ § ЇЁбЁ ў Єi­Ґжм д ©« }
repeat{–ЁЄ« ўў®¤  § ЇЁбiў}
if Edit then{ѓ®вгу¬® § Ј «®ў®Є} s:='ђҐ¤ Јгў ­­п:'
else
begin
Str(Filesize(f)+1,s);
s:='‚ў®¤Ёвмбп § ЇЁб:';
end;
FillChar(data,SizeOf(data),' ');{‡ Ї®ў­пу¬® Ї®«п Їа®Ўi« ¬Ё}
R.Assign(15,2,39,19);
InWin:=New(PDialog,Init(R,s));{‘вў®аоу¬® ўiЄ­®}
with InWin^ do
begin{”®а¬гу¬® ўiЄ­®}
R.Assign(2,y+1,22,y+2);
Bnazva:=New(PInputLine,Init(R,Lnazva));
Insert(Bnazva);
R.Assign(2,y,22,y+1);
Insert(New(PLabel,Init(R,'Ќ §ў ',Bnazva)));
R.Assign(2,y+dy+1,22,y+dy+2);
Bmarka:=New(PInputLine,Init(R,Lmarka));
Insert(Bmarka);
R.Assign(2,y+dy,22,y+dy+1);
Insert(New(PLabel,Init(R,'Њ аЄ ',Bmarka)));
R.Assign(2,y+2*dy+1,22,y+2*dy+2);
Brik:=New(PInputLine,Init(R,Lrik));
Insert(Brik);
R.Assign(2,y+2*dy,22,y+2*dy+1);
Insert(New(PLabel,Init(R,'ђiЄ',Brik)));
R.Assign(2,y+3*dy+1,22,y+3*dy+2);
Bobem:=New(PInputLine,Init(R,Lobem));
Insert(Bobem);
R.Assign(2,y+3*dy,22,y+3*dy+1);
Insert(New(PLabel,Init(R,'ЋЎ"Ґ¬',Bobem)));
R.Assign(2,y+4*dy+1,22,y+4*dy+2);
Bcolir:=New(PInputLine,Init(R,Lcolir));
Insert(Bcolir);
R.Assign(2,y+4*dy,22,y+4*dy+1);
Insert(New(PLabel,Init(R,'Љ®«iа',Bcolir)));
R.Assign(2,y+5*dy+1,22,y+5*dy+2);
Bcina:=New(PInputLine,Init(R,Lcina));
Insert(Bcina);
R.Assign(2,y+5*dy,22,y+5*dy+1);
Insert(New(PLabel,Init(R,'–i­ ',Bcina)));
{‚бв ў«пу¬® ¤ўi Є®¬ ­¤­i Є­®ЇЄЁ}
R.Assign(2,y+6*dy+1,12,y+6*dy+3);
Insert(New(PButton,Init(R,'‚ўҐбвЁ',cmOK,bfDefault)));
R.Assign(2+10,y+6*dy+1,12+10,y+6*dy+3);
Insert(New(Pbutton,Init(R,'‚Ёеi¤',cmCancel,BfNormal)));
SelectNext(False);{ ЄвЁўгу¬® ЇҐаиг Є­®ЇЄг}
end;{Љi­Ґжм д®а¬гў ­­п ўiЄ­ }
if Edit then With data do
begin{ѓ®вгу¬® Ї®з вЄ®ўЁ© ⥪бв:}
p:=PS^.At(Location);{—Ёв у¬® ¤ ­i § § ЇЁбг}
s:=p^;
nazva:=copy(s,1,Lnazva);
marka:=copy(s,succ(Lnazva),Lmarka);
rik:=copy(s,succ(Lnazva+Lmarka),Lrik);
obem:=copy(s,succ(Lnazva+Lmarka+Lrik),Lobem);
colir:=copy(s,succ(Lnazva+Lmarka+Lrik+Lobem),Lcolir);
cina:=copy(s,succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir),Lcina);
InWin^.SetData(data);{‚бв ў«пу¬ ⥪бв ў Ї®«п ўў®¤г}
end;
control:=DeskTop^.ExecView(InWin);{Џа®ў®¤Ё¬® ¤i «®Ј}
if Control=cmOk then with data do
begin
if Edit then DeleteItem;{‡­Ёйгу¬® бв аЁ© § ЇЁб}
nazva:=Bnazva^.data^;
marka:=Bmarka^.data^;
rik:=Brik^.data^;
obem:=Bobem^.data^;
colir:=Bcolir^.data^;
cina:=Bcina^.data^;
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
OldCount:=PS^.Count;{Џ®ЇҐаҐ¤­п Є-бвм § ЇЁбiў}
PS^.Insert(NewStr(s));{„®Ў ў«пу¬ ў Є®«ҐЄжiо}
{ЏҐаҐўiапу¬® ¤®Ў ў«Ґ­­п}
if OldCount<>Ps^.Count then Write(f,data);
{’ Є - ¤®Ў ў«пу¬ ў д ©«}
end
until Edit or (Control=cmCancel);
Draw;
end;
{---------------------------------------------------------------------------}
Procedure SearchItem;
{---------------------------------------------------------------------------}
{˜гЄ у¬® Ї®ваiЎ­Ё© Ґ«Ґ¬Ґ­в}
{---------------------------------------------------------------------------}
Function UpString(s:string):String;
{---------------------------------------------------------------------------}
{ЏҐаҐвў®аоу¬® бва®Єг ў ўҐае­i© аҐубва}
var k:integer;
begin
for k:=1 to Length(s) do
if s[k] in ['a'..'z'] then
s[k]:=chr(ord('A')+ord(s[k])-ord('a'))
else
if s[k] in [' '..'Ї'] then
s[k]:=chr(ord('Ђ')+ord(s[k])-ord(' '))
else
if s[k] in ['а'..'п'] then
s[k]:=chr(ord('ђ')+ord(s[k])-ord('а'));
UpString:=s;
end;
{---------------------------------------------------------------------------}
Procedure NotFound;
{---------------------------------------------------------------------------}
begin
MessageBox('‡  ¤ ­Ё¬ § ЇЁв®¬ ­Ґ §­ ©¤Ґ­® ¦®¤­®Ј® § ЇЁбг',nil,mfInformation or mfOkButton);
end;
{---------------------------------------------------------------------------}
Procedure Searchnazva;
{---------------------------------------------------------------------------}
const LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
var InWin:PDialog;
R:TRect;
s,ss,shapka:String;
p:PInputLine;
pp:Pstring;
Data:autopark;
kk,ii,kp,zap:integer;
b1:TDrawBuffer;
col:byte;
k:Word;
begin
R.Assign(15,8,45,15);
InWin:=New(PDialog,Init(R,'Џ®игЄ § ЇЁбг...'));
with InWin^ do
begin
R.Assign(2,2,28,3);
p:=New(PInputLine,Init(R,20));
Insert(p);
R.Assign(1,1,21,2);
Insert(New(PLabel,Init(R,'§  ­ §ў®о:',p)));
R.Assign(2,4,12,6);
Insert(New(PButton,Init(R,'‡­ ©вЁ',cmOk,bfDefault)));
R.Assign(18,4,28,6);
Insert(New(PButton,Init(R,'‚Ёеi¤',cmCancel,bfNormal)));
SelectNext(False);
end;
if DeskTop^.ExecView(InWin)=cmCancel then exit;
s:=p^.Data^;
Location:=0;
kp:=0;
kk:=0;
for i:=1 to pred(PS^.Count) do
begin
pp:=PS^.At(i);
ss:=pp^;
with data do
begin
nazva:=copy(ss,1,Lnazva);
marka:=copy(ss,succ(Lnazva),Lmarka);
rik:=copy(ss,succ(Lnazva+Lmarka),Lrik);
obem:=copy(ss,succ(Lnazva+Lmarka+Lrik),Lobem);
colir:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem),Lcolir);
cina:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir),Lcina);
end;
if pos(UpString(s),Upstring(Data.nazva)) <> 0 then
begin
kk:=kk+1;
Posh[kk]:=Data;
end;
kp:=kp+1;
Poz[kp]:=Data;
end;
if kk<>0 then
begin
zap:=kp;
i:=0;
PS:=New(PStringCollection,Init(100,10));
shapka:=' Ќ §ў  | Њ аЄ  | ђiЄ | ЋЎ"Ґ¬ | Љ®«iа | –i­  ';
PS^.insert(NewStr(shapka));
for i:=1 to kk do
begin
with Posh[i] do
begin
s[0] := chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));{¤®Ў ў«пҐ¬ ў Є®«ҐЄжЁо}
end;
i:=kk+1;
with Poz[kp] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));
location:=0;
Draw;
end
else NotFound;
end;
{---------------------------------------------------------------------------}
Procedure Searchmarka;
{---------------------------------------------------------------------------}
const LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
var InWin:PDialog;
R:TRect;
s,ss,shapka:String;
p:PInputLine;
pp:Pstring;
Data:autopark;
kk,ii,kp,zap:integer;
b1:TDrawBuffer;
col:byte;
k:Word;
begin
R.Assign(15,8,45,15);
InWin:=New(PDialog,Init(R,'Џ®игЄ § ЇЁбг...'));
with InWin^ do
begin
R.Assign(2,2,28,3);
p:=New(PInputLine,Init(R,20));
Insert(p);
R.Assign(1,1,21,2);
Insert(New(PLabel,Init(R,'§  ¬ аЄ®о:',p)));
R.Assign(2,4,12,6);
Insert(New(PButton,Init(R,'‡­ ©вЁ',cmOk,bfDefault)));
R.Assign(18,4,28,6);
Insert(New (PButton,Init(R,'‚Ёеi¤' ,cmCancel,bfNormal)));
SelectNext(False);
end;
if DeskTop^.ExecView(InWin)=cmCancel then exit;
s:=p^.Data^;
Location:=1;
kp:=0;
kk:=0;
for i:=1 to pred(PS^.Count) do
begin
pp:=PS^.At(i);
ss:=pp^;
with data do
begin
nazva:=copy(ss,1,Lnazva);
marka:=copy(ss,succ(Lnazva),Lmarka);
rik:=copy(ss,succ(Lnazva+Lmarka),Lrik);
obem:=copy(ss,succ(Lnazva+Lmarka+Lrik),Lobem);
colir:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem),Lcolir);
cina:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir),Lcina);
end;
if pos(UpString(s),Upstring(Data.marka)) <> 0 then
begin
kk:=kk+1;
Posh[kk]:=Data;
end;
kp:=kp+1;
Poz[kp]:=Data;
end;
if kk<>0 then
begin
zap:=kp;
i:=0;
PS:=New(PStringCollection,Init(100,10));
shapka:=' Ќ §ў  | Њ аЄ  | ђiЄ | ЋЎ"Ґ¬ | Љ®«iа | –i­  ';
PS^.insert(NewStr(shapka));
for i:=1 to kk do
begin
with Posh[i] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));{¤®¤ у¬® г Є®«ҐЄжiо}
end;
i:=kk+1;
with Poz[kp] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));
location:=1;
Draw;
end
else NotFound;
end;
{---------------------------------------------------------------------------}
Procedure Searchrik;
{---------------------------------------------------------------------------}
const LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
var InWin:PDialog;
R:TRect;
s,ss,shapka:String;
p,p2:PInputLine;
pp:Pstring;
Data:autopark;
kk,ii,kp,zap:integer;
b1:TDrawBuffer;
col:byte;
k:Word;
begin
R.Assign(15,7,45,16);
InWin:=New(PDialog,Init(R,'Џ®игЄ §  а®Є®¬...'));
with InWin^ do
begin
R.Assign(2,2,28,3) ;
p:=New(PInputLine,Init(R,20));
Insert(p);
R.Assign(1,1,21,2);
Insert(New(PLabel,Init(R,'ўi¤:',p)));

R.Assign(2,4,28,5);
p2:=New(PInputLine,Init(R,20));
Insert(p2);
R.Assign(1,3,21,4);
Insert(New(PLabel,Init(R,'¤®:',p2)));

R.Assign(2,6,12,8);
Insert (New(PButton,Init(R,'‡­ ©вЁ',cmOk,bfDefault)));
R.Assign(18,6,28,8);
Insert(New(PButton,Init(R,'‚Ёеi¤',cmCancel,bfNormal)));
SelectNext(False);
end;
if DeskTop^.ExecView(InWin)=cmCancel then exit;
s:=p^.Data^;
Location:=1;
kp:=0;
kk:=0;
for i:=1 to pred(PS^.Count) do
begin
pp:=PS^.At(i);
ss:=pp^;
with data do
begin
nazva:=copy(ss,1,Lnazva);
marka:=copy(ss,succ(Lnazva),Lmarka);
rik:=copy(ss,succ(Lnazva+Lmarka),Lrik);
obem:=copy(ss,succ(Lnazva+Lmarka+Lrik),Lobem);
colir:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem),Lcolir);
cina:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir),Lcina);
end;
if UpString(s)=copy(Upstring(Data.rik),1,length(s)) then
begin
kk:=kk+1;
Posh[kk]:=Data;
end;
kp:=kp+1;
Poz[kp]:=Data;
end;
if kk<>0 then
begin
zap:=kp;
i:=0;
PS:=New(PStringCollection,Init(100,10));
shapka:=' Ќ §ў  | Њ аЄ  | ђiЄ | ЋЎ"Ґ¬ | Љ®«iа | –i­  ';
PS^.insert(NewStr(shapka));
for i:=1 to kk do
begin
with Posh[i] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));{¤®¤ у¬® г Є®«ҐЄжiо}
end;
i:=kk+1;
with Poz[kp] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));
location:=1;
Draw;
end
else NotFound;
end;
{---------------------------------------------------------------------------}
Procedure Searchobem;
{---------------------------------------------------------------------------}
const LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
var InWin:PDialog;
R:TRect;
s,ss,shapka:String;
p,p2:PInputLine;
pp:Pstring;
Data:autopark;
kk,ii,kp,zap:integer;
b1:TDrawBuffer;
col:byte;
k:Word;
begin
R.Assign(15,7,45,16);
InWin:=New(PDialog,Init(R,'Џ®игЄ §  ®Ў"н¬®¬...'));
with InWin^ do
begin
R.Assign(2,2,28,3);
p:=New(PInputLine,Init(R,20));
Insert(p);
R.Assign(1,1,21,2);
Insert(New(PLabel,Init(R,'ўi¤:',p)));

R.Assign(2,4,28,5);
p2:=New(PInputLine,Init(R,20));
Insert(p2);
R.Assign(1,3,21,4);
Insert(New(PLabel,Init(R,'¤®:',p2)));

R.Assign(2,6,12,8);
Insert(New(PButton,Init(R,'‡­ ©вЁ',cmOk,bfDefault)));
R.Assign(18,6,28,8);
Insert(New(PButton,Init(R,'‚Ёеi¤',cmCancel,bfNormal)));
SelectNext (False);
end;
if DeskTop^.ExecView(InWin)=cmCancel then exit;
s:=p^.Data^;
Location:=1;
kp:=0;
kk:=0;
for i:=1 to pred(PS^.Count) do
begin
pp:=PS^.At(i);
ss:=pp^;
with data do
begin
nazva:=copy(ss,1,Lnazva);
marka:=copy(ss,succ(Lnazva),Lmarka);
rik:=copy(ss,succ(Lnazva+Lmarka),Lrik);
obem:=copy(ss,succ(Lnazva+Lmarka+Lrik),Lobem);
colir:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem),Lcolir);
cina:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir),Lcina);
end;
if UpString(s)=copy(Upstring(Data.obem),1,length(s)) then
begin
kk:=kk+1;
Posh[kk]:=Data;
end;
kp:=kp+1;
Poz[kp]:=Data;
end;
if kk<>0 then
begin
zap:=kp;
i:=0;
PS:=New(PStringCollection,Init(100,10));
shapka:=' Ќ §ў  | Њ аЄ  | ђiЄ | ЋЎ"Ґ¬ | Љ®«iа | –i­  ';
PS^.insert(NewStr(shapka));
for i:=1 to kk do
begin
with Posh[i] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));{¤®¤ у¬® г Є®«ҐЄжiо}
end;
i:=kk+1;
with Poz[kp] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));
location:=1;
Draw;
end
else NotFound;
end;
{---------------------------------------------------------------------------}
Procedure Searchcolir;
{---------------------------------------------------------------------------}
const LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
var InWin:PDialog;
R:TRect;
s,ss,shapka:String;
p:PInputLine;
pp:Pstring;
Data:autopark;
kk,ii,kp,zap:integer;
b1:TDrawBuffer;
col:byte;
k:Word;
begin
R.Assign(15,8,45,15);
InWin:=New(PDialog,Init(R,'Џ®игЄ § ЇЁбг...'));
with InWin^ do
begin
R.Assign(2,2,28,3);
p:=New(PInputLine,Init(R,20));
Insert(p);
R.Assign(1,1,21,2);
Insert(New(PLabel,Init(R,'§  Є®«м®а®¬:',p)));
R.Assign(2,4,12,6);
Insert(New(PButton,Init(R,'‡­ ©вЁ',cmOk,bfDefault)));
R.Assign(18,4,28,6);
Insert(New(PButton,Init(R,'‚Ёеi¤',cmCancel,bfNormal)));
SelectNext(False);
end;
if DeskTop^.ExecView(InWin)=cmCancel then exit;
s:=p^.Data^;
Location:=1;
kp:=0;
kk:=0;
for i:=1 to pred(PS^.Count) do
begin
pp:=PS^.At(i);
ss:=pp^;
with data do
begin
nazva:=copy(ss,1,Lnazva);
marka:=copy(ss,succ(Lnazva),Lmarka);
rik:=copy(ss,succ(Lnazva+Lmarka),Lrik);
obem:=copy(ss,succ(Lnazva+Lmarka+Lrik),Lobem);
colir:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem),Lcolir);
cina:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir),Lcina);
end;
if UpString(s)=copy(Upstring(Data.colir),1,length(s)) then
begin
kk:=kk+1;
Posh[kk]:=Data;
end;
kp:=kp+1;
Poz[kp]:=Data;
end;
if kk<>0 then
begin
zap:=kp;
i:=0;
PS:=New(PStringCollection,Init(100,10));
shapka:=' Ќ §ў  | Њ аЄ  | ђiЄ | ЋЎ"Ґ¬ | Љ®«iа | –i­  ';
PS^.insert(NewStr(shapka));
for i:=1 to kk do
begin
with Posh[i] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));{¤®¤ у¬® г Є®«ҐЄжiо}
end;
i:=kk+1;
with Poz[kp] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));
location:=1;
Draw;
end
else NotFound;
end;
{---------------------------------------------------------------------------}
Procedure Searchcina;
{---------------------------------------------------------------------------}
const LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
var InWin:PDialog;
R:TRect;
s,ss,shapka:String;
p,p2:PInputLine;
pp:Pstring;
Data:autopark;
kk,ii,kp,zap:integer;
b1:TDrawBuffer;
col:byte;
k:Word;
begin
R.Assign(15,7,45,16);
InWin:=New(PDialog,Init(R,'Џ®игЄ §  жi­®о...'));
with InWin^ do
begin
R.Assign(2,2,28,3);
p:=New(PInputLine,Init(R,20));
Insert(p);
R.Assign(1,1,21,2);
Insert(New(PLabel,Init(R,'ўi¤:',p)));

R.Assign(2,4,28,5);
p2:=New(PInputLine,Init(R,20));
Insert(p2);
R.Assign(1,3,21,4);
Insert(New(PLabel,Init(R,'¤®:',p2)));

R.Assign(2,6,12,8);
Insert(New(PButton,Init(R,'‡­ ©вЁ',cmOk,bfDefault)));
R.Assign(18,6,28,8);
Insert(New(PButton,Init(R,'‚Ёеi¤',cmCancel,bfNormal)));
SelectNext(False);
end;
if DeskTop^.ExecView(InWin)=cmCancel then exit;
s:=p^.Data^;
Location:=1;
kp:=0;
kk:=0;
for i:=1 to pred(PS^.Count) do
begin
pp:=PS^.At(i);
ss:=pp^;
with data do
begin
nazva:=copy(ss,1,Lnazva);
marka:=copy(ss,succ(Lnazva),Lmarka);
rik:=copy(ss,succ(Lnazva+Lmarka),Lrik);
obem:=copy(ss,succ(Lnazva+Lmarka+Lrik),Lobem);
colir:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem),Lcolir);
cina:=copy(ss,succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir),Lcina);
end;
if UpString(s)=copy(Upstring(Data.cina),1,length(s)) then
begin
kk:=kk+1;
Posh[kk]:=Data;
end;
kp:=kp+1;
Poz[kp]:=Data;
end;
if kk<>0 then
begin
zap:=kp;
i:=0;
PS:=New(PStringCollection,Init(100,10));
shapka:=' Ќ §ў  | Њ аЄ  | ђiЄ | ЋЎ"Ґ¬ | Љ®«iа | –i­  ';
PS^.insert(NewStr(shapka));
for i:=1 to kk do
begin
with Posh[i] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));{¤®¤ у¬® г Є®«ҐЄжiо}
end;
i:=kk+1;
with Poz[kp] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));
location:=1;
Draw;
end
else NotFound;
end;
{---------------------------------------------------------------------------}
Procedure Searchall;
{---------------------------------------------------------------------------}
const LLine=Lnazva+Lmarka+Lrik+Lobem+Lcolir+Lcina;
var InWin:PDialog;
R:TRect;
s,ss,shapka:String;
p:PInputLine;
pp:Pstring;
Data:autopark;
kk,ii,kp,zap:integer;
b1:TDrawBuffer;
k:Word;
begin
R.Assign(15,8,45,15) ;
InWin:=New(PDialog,Init(R,'Џ®игЄ § ЇЁбг...'));
with InWin^ do
begin
R.Assign(2,2,28,3);
p:=New(PInputLine,Init(R,20));
Insert(p);
R.Assign(1,1,21,2);
Insert(New(PLabel,Init(R,'‡ Ј «м­Ё©:',p)));
R.Assign(2,4,12,6);
Insert(New(PButton,Init(R,'‡­ ©вЁ',cmOk,bfDefault)));
R.Assign(18,4,28,6);
Insert(New(PButton,Init(R,'‚Ёеi¤',cmCancel,bfNormal)));
SelectNext(False);
end;
if DeskTop^.ExecView(InWin)=cmCancel then exit;
s:=p^.Data^;
Location:=1;
kp:=0;
kk:=0;
for i:=1 to pred(PS^.Count) do
begin
pp:=PS^.At(i);
ss:=pp^;
with data do
begin
nazva:=copy(ss,1,Lnazva);
marka:=copy(ss,Lnazva+1,Lmarka);
rik:=copy(ss,Lnazva+Lmarka+1,Lrik);
obem:=copy(ss,Lnazva+Lmarka+Lrik+1,Lobem);
colir:=copy(ss,Lnazva+Lmarka+Lrik+Lobem+1,Lcolir);
cina:=copy(ss,Lnazva+Lmarka+Lrik+Lobem+Lcolir+1,Lcina);
end;
if (UpString(s)=copy(Upstring(Data.nazva),1,length(s))) or
(UpString(s)=copy(Upstring(Data.marka),1,length(s))) or
(UpString(s)=copy(Upstring(Data.rik),1,length(s))) or
(UpString(s)=copy(Upstring(Data.obem),1,length(s))) or
(UpString(s)=copy(Upstring(Data.colir),1,length(s))) or
(UpString(s)=copy(Upstring(Data.cina),1,length(s)))
then
begin
kk:=kk+1;
Posh[kk]:=Data;
end;
kp:=kp+1;
Poz[kp]:=Data;
end;
if kk<>0 then
begin
zap:=kp;
i:=0;
PS:=New(PStringCollection,Init(100,10));
shapka:=' Ќ §ў  | Њ аЄ  | ђiЄ | ЋЎ"Ґ¬ | Љ®«iа | –i­  ';
PS^.insert(NewStr(shapka));
for i:=1 to kk do
begin
with Posh[i] do
begin
s[0]:=chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));{¤®¤ у¬® г Є®«ҐЄжiо}
end;
i:=kk+1;
with Poz[kp] do
begin
s[0] := chr(LLine);
FillChar(s[1],LLine,' ');
move(nazva[1],s[1],Length(nazva));
move(marka[1],s[succ(Lnazva)],Length(marka));
move(rik[1],s[succ(Lnazva+Lmarka)],Length(rik));
move(obem[1],s[succ(Lnazva+Lmarka+Lrik)],Length(obem));
move(colir[1],s[succ(Lnazva+Lmarka+Lrik+Lobem)],Length(colir));
move(cina[1],s[succ(Lnazva+Lmarka+Lrik+Lobem+Lcolir)],Length(cina));
end;
PS^.Insert(NewStr(s));
location:=1;
Draw;
end
else NotFound;
end;
{---------------------------------------------------------------------------}
begin
case poshuk of
cmSearchnazva:Searchnazva;
cmSearchmarka:Searchmarka;
cmSearchrik:Searchrik;
cmSearchobem:Searchobem;
cmSearchcolir:Searchcolir;
cmSearchcina:Searchcina;
cmSearchAll:SearchAll;
end;
end;{SearchItem}
{--------------------------------------------------------------------------------}
var R:TPoint;
label cls;
begin
TScroller.HandleEvent(Event);
case Event.What of evCommand:
case Event.Command of cmClose:
begin
Cls:
case Control of{ЋваЁ¬ вЁ Є®¬ ­¤г § ®б­®ў­®Ј® ¤i «®Ј®ў®Ј® ўiЄ­ }
cmCan,
cmCancel:EndModal(cmCancel);
cmEdit:AddItem(True);
cmDelete:DeleteItem;
cmSearch:SearchItem;
cmAdd:AddItem(False);
end;
end;
cmzoom:exit;
end;
evMouseDown:{ђҐ Єжiп ­  ­ ¦ ввп Є« ўiиЁ ¬Ёиi}
begin
MakeLocal(MouseWhere,R);{ЋваЁ¬гу¬® ў R «®Є «м­i Є®®а¤Ё­ вЁ
ўЄ §iў­ЁЄ  ¬Ёиi}
Location:=Delta.Y+R.Y;
Draw;
end;
evKeyDown:{ђҐ Єжiп ­  Є« ўiиЁ + -}
case Event.KeyCode of
kbEsc: goto Cls;
kbGrayMinus: if Location>Delta.Y then
begin
dec(Location);
Draw;
end;
kbGrayPlus:
if Location<Delta.Y+pred(Size.Y) then
begin
inc(Location);
Draw;
end;
end;
end;
end;{TInterior.HandleEvent}
{---------------------------------------------------------------------------}
Procedure Tbook.Work;
{---------------------------------------------------------------------------}
{ђ®Ў®в  § ¤ ­Ё¬Ё}
var R:TRect;
Control:Word;
PW:PWorkWin;
begin
R.Assign(0,0,80,23);
PW:=New(PWorkWin,Init®);
Control:=DeskTop^.ExecView(PW);
Dispose(PW,Done);
end;
{---------------------------------------------------------------------------}
Procedure Tbook.HandleEvent(var Event:TEvent);
{---------------------------------------------------------------------------}
{ЋЎа®Ў«оў з Ї®¤i© Їа®Ја ¬Ё}
type TEvent=record
What:Word;{ЋЇаЁ¤i«пу вЁЇ Ї®¤iх}
case Word of{"Џгбв " Ї®¤iп}
evMouse:({Џ®¤iп ўi¤ ¬ЁиЄЁ:}
Buttons:Byte;{‘в ­ Є« ўiи}
Double:Boolean;{Ћ§­ Є  Ї®¤ўi©­®Ј® ­ ¦ ввп Є­®ЇЄЁ ¬ЁиЁ}
Where:TPoint);{Љ®®а¤Ё­ вЁ Єгаб®а  ¬ЁиЁ}
evKeyDown:({Џ®¤iп ўi¤ Є« ўi вгаЁ:}
case Integer of
0:(KeyCode:Word);{Љ®¤ Є« ўiиЁ}
1:(CharCode:Byte;
ScanCode:Byte));
evMessage:({Џ®¤iп-§ўiбв®зЄ :}
Command:Word;{Љ®¤ Є®¬ ­¤Ё}
case Word of
0:(InfoPtr:Pointer);
1:(InfoLong:LongInt);
2:(Infoword:Word);
3:(InfoInt:Integer);
4:(InfoByte:Byte);
5:(InfoChar:Char));
end;
begin {TDovidnuk.HandleEvent}
TApplication.HandleEvent(Event);{ЋЎа®ЎЄ  бв ­¤ ав­Ёе Є®¬ ­¤ cmQuit i cmMenu}
if Event.What=evCommand then
case Event.Command of{ЋЎа®ЎЄ  ­®ўЁе Є®¬ ­¤}
cmOpen:FileOpen;
cmSave:FileSave;
cmChangeDir:ChangeDir;
cmDOSShell:ShallDOS;
cmWork:Work;
cmAvtorA:AvtorA;
cmAvtorV:AvtorV;
else
exit;{ЌҐ ®Ўа®Ў«пвЁ i­иi Є®¬ ­¤Ё}
end;
ClearEvent(Event);{ЋзЁбвЁвЁ Ї®¤iх Їiб«п ®Ўа®Ў«Ґ­­п}
end;{TDovidnuk.HandleEvent}
{---------------------------------------------------------------------------}
Procedure Tbook.InitMenuBar;
{---------------------------------------------------------------------------}
{‘⢮७­п ўҐае­м®Ј® ¬Ґ­о}
var R:TRect;
begin
GetExtent®;
R.B.Y:=succ(R.A.Y);{R -Є®®а¤Ё­ вЁ бва®ЄЁ ¬Ґ­о}
MenuBar:=New(PMenuBar,Init(R,
NewMenu(
NewSubMenu('~F~/ ” ©«', hcNoContext,
NewMenu(
NewItem('~1~/ ‚i¤ЄаЁвЁ','F3',kbF3,cmOpen,hcNoContext,
NewItem('~2~/ ‡ ЄаЁвЁ','F2',kbF2,cmSave,hcNoContext,
NewItem('~3~/ ‡¬i­ЁвЁ ¤ЁбЄ','',0,cmChangeDir,hcNoContext,
NewLine(
NewItem('~4~/ ‚ЁЄ«ЁЄ DOS','',0,cmDOSShell,hcNoContext,
NewItem('~5~/ Љi­Ґжм а®Ў®вЁ','Alt-X',kbAltX,cmQuit,hcNoContext,
NIL)))))) {ЌҐ¬  i­иЁе Ґ«Ґ¬Ґ­вiў Їi¤¬Ґ­о}),
NewSubMenu('~A~/ Ђўв®а',hcNoContext,
NewMenu(
NewItem('~1~/ Ђўв®а Їа®Ја ¬Ё','Alt-P',kbAltP,cmAvtorA,hcNoContext,
NewLine(
NewItem('~2~/ ‚ЁЄ« ¤ з','Alt-V',kbAltV,cmAvtorV,hcNoContext,
NIL)))),
NIL)))));
end;{TDovidnuk.InitMenuBar;}
{---------------------------------------------------------------------------}
Procedure Tbook.InitStatusLine;
{---------------------------------------------------------------------------}
{ЋЇЁб ­­п ­®ў®Ј® ¬Ґв®¤ , § ¤®Ї®¬®Ј®о пЄ®Ј® бвў®аоувмбп бва®Є  бв вгб }
var R:Trect;
begin
GetExtent®;
R.A.Y:=pred(R.B.Y);{Џ®¬iй у¬ ў R Є®®а¤Ё­ вЁ бва®ЄЁ бв вгб }
{‘вў®аоу¬ бва®Єг бв вгб :}
StatusLine:=New(PStatusLine,Init(R,
{ЋЇаЁ¤i«пу¬ ®¤Ё­ ў аi ­в бва®ЄЁ бв вгб :}
NewStatusDef(0, $FFFF,{ўбв ­®ў«оу¬® ¤«п жм®Ј® ў аi ­в  ¬ ЄбЁ¬ «м­Ё© ¤i Ї §®­ Є®­вҐЄбв­®х бЇа ў®з­®х б«г¦ЎЁ}
NewStatusKey('~Alt-X~ ‚Ёеi¤',kbAltX,cmQuit,
NewStatusKey('~F10~ ЊҐ­о',kbF10,cmMenu,
NIL)), {ЌҐ¬  i­иЁе Є« ўiи}
NIL) {ЌҐ¬  i­иЁе ўЁ§­ зҐ­м}));
DisableCommands(Wincom1)
end;{TDovidnuk.InitStatusLine}
{--------------------------------------------------------------------------------}
end.

 К началу страницы 
+ Ответить 

 Ответить  Открыть новую тему 
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 





- Текстовая версия 1.10.2020 21:21
500Gb HDD, 6Gb RAM, 2 Cores, 7 EUR в месяц — такие хостинги правда бывают
Связь с администрацией: bu_gen в домене octagram.name