программа - бд каждая кнопка отвечает за фильтрацию, просто изначально кнопки у меня появляются в 1м месте по горизонтали, а потом ,при 1вом клике по одной из кнопок, с лева по вертикале.
вот как пришлось зделать:
Код:
const
StepCount = 200;
var
Form2: TForm2;
i: Integer;
Btn1LT0, Btn2LT0, Btn3LT0, Btn4LT0, Btn5LT0: TPoint;
Btn1LT, Btn2LT, Btn3LT, Btn4LT, Btn5LT: TPoint;
implementation
uses Unit3, Unit1;
{$R *.dfm}
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
Btn1LT0.X := BitBtn1.Left; Btn1LT0.Y := BitBtn1.Top;
Btn2LT0.X := BitBtn2.Left; Btn2LT0.Y := BitBtn2.Top;
Btn3LT0.X := BitBtn3.Left; Btn3LT0.Y := BitBtn3.Top;
Btn4LT0.X := BitBtn4.Left; Btn4LT0.Y := BitBtn4.Top;
Btn5LT0.X := BitBtn5.Left; Btn5LT0.Y := BitBtn5.Top;
Btn1LT.X := 16; Btn1LT.Y := 50;
Btn2LT.X := 16; Btn2LT.Y := 150;
Btn3LT.X := 16; Btn3LT.Y := 250;
Btn4LT.X := 16; Btn4LT.Y := 250;
Btn5LT.X := 16; Btn5LT.Y := 350;
for i := 1 to StepCount do
begin
BitBtn1.Left := Round(Btn1LT0.X + i * (Btn1LT.X - Btn1LT0.X) / StepCount);
BitBtn1.Top := Round(Btn1LT0.Y + i * (Btn1LT.Y - Btn1LT0.Y) / StepCount);
BitBtn2.Left := Round(Btn2LT0.X + i * (Btn2LT.X - Btn2LT0.X) / StepCount);
BitBtn2.Top := Round(Btn2LT0.Y + i * (Btn2LT.Y - Btn2LT0.Y) / StepCount);
BitBtn3.Left := Round(Btn3LT0.X + i * (Btn3LT.X - Btn3LT0.X) / StepCount);
BitBtn3.Top := Round(Btn3LT0.Y + i * (Btn3LT.Y - Btn3LT0.Y) / StepCount);
BitBtn4.Left := Round(Btn4LT0.X + i * (Btn4LT.X - Btn4LT0.X) / StepCount);
BitBtn4.Top := Round(Btn4LT0.Y + i * (Btn4LT.Y - Btn4LT0.Y) / StepCount);
BitBtn5.Left := Round(Btn5LT0.X + i * (Btn5LT.X - Btn5LT0.X) / StepCount);
BitBtn5.Top := Round(Btn5LT0.Y + i * (Btn5LT.Y - Btn5LT0.Y) / StepCount);
Application.ProcessMessages;
end;
Form2.Label1.Caption:='';
Form2.Panel1.Caption:='';
GroupBox7.Visible:=true;
GroupBox8.Visible:=true;
Table1.Filter:='Klas='''+'film''';
Table1.Filtered:=True;
end;
procedure TForm2.BitBtn2Click(Sender: TObject);
begin
Btn1LT0.X := BitBtn1.Left; Btn1LT0.Y := BitBtn1.Top;
Btn2LT0.X := BitBtn2.Left; Btn2LT0.Y := BitBtn2.Top;
Btn3LT0.X := BitBtn3.Left; Btn3LT0.Y := BitBtn3.Top;
Btn4LT0.X := BitBtn4.Left; Btn4LT0.Y := BitBtn4.Top;
Btn5LT0.X := BitBtn5.Left; Btn5LT0.Y := BitBtn5.Top;
Btn1LT.X := 16; Btn1LT.Y := 50;
Btn2LT.X := 16; Btn2LT.Y := 150;
Btn3LT.X := 16; Btn3LT.Y := 250;
Btn4LT.X := 16; Btn4LT.Y := 350;
Btn5LT.X := 16; Btn5LT.Y := 450;
for i := 1 to StepCount do
begin
BitBtn1.Left := Round(Btn1LT0.X + i * (Btn1LT.X - Btn1LT0.X) / StepCount);
BitBtn1.Top := Round(Btn1LT0.Y + i * (Btn1LT.Y - Btn1LT0.Y) / StepCount);
BitBtn2.Left := Round(Btn2LT0.X + i * (Btn2LT.X - Btn2LT0.X) / StepCount);
BitBtn2.Top := Round(Btn2LT0.Y + i * (Btn2LT.Y - Btn2LT0.Y) / StepCount);
BitBtn3.Left := Round(Btn3LT0.X + i * (Btn3LT.X - Btn3LT0.X) / StepCount);
BitBtn3.Top := Round(Btn3LT0.Y + i * (Btn3LT.Y - Btn3LT0.Y) / StepCount);
BitBtn4.Left := Round(Btn4LT0.X + i * (Btn4LT.X - Btn4LT0.X) / StepCount);
BitBtn4.Top := Round(Btn4LT0.Y + i * (Btn4LT.Y - Btn4LT0.Y) / StepCount);
BitBtn5.Left := Round(Btn5LT0.X + i * (Btn5LT.X - Btn5LT0.X) / StepCount);
BitBtn5.Top := Round(Btn5LT0.Y + i * (Btn5LT.Y - Btn5LT0.Y) / StepCount);
Application.ProcessMessages;
end;
Form2.Label1.Caption:='';
Form2.Panel1.Caption:='';
GroupBox7.Visible:=true;
GroupBox8.Visible:=true;
Table1.Filter:='Klas='''+'myz''';
Table1.Filtered:=True;
end;
procedure TForm2.BitBtn3Click(Sender: TObject);
begin
// находим начальные положения кнопок
Btn1LT0.X := BitBtn1.Left; Btn1LT0.Y := BitBtn1.Top;
Btn2LT0.X := BitBtn2.Left; Btn2LT0.Y := BitBtn2.Top;
Btn3LT0.X := BitBtn3.Left; Btn3LT0.Y := BitBtn3.Top;
Btn4LT0.X := BitBtn4.Left; Btn4LT0.Y := BitBtn4.Top;
Btn5LT0.X := BitBtn5.Left; Btn5LT0.Y := BitBtn5.Top;
Btn1LT.X := 16; Btn1LT.Y := 50;
Btn2LT.X := 16; Btn2LT.Y := 150;
Btn3LT.X := 16; Btn3LT.Y := 250;
Btn4LT.X := 16; Btn4LT.Y := 350;
Btn5LT.X := 16; Btn5LT.Y := 450;
for i := 1 to StepCount do
begin
BitBtn1.Left := Round(Btn1LT0.X + i * (Btn1LT.X - Btn1LT0.X) / StepCount);
BitBtn1.Top := Round(Btn1LT0.Y + i * (Btn1LT.Y - Btn1LT0.Y) / StepCount);
BitBtn2.Left := Round(Btn2LT0.X + i * (Btn2LT.X - Btn2LT0.X) / StepCount);
BitBtn2.Top := Round(Btn2LT0.Y + i * (Btn2LT.Y - Btn2LT0.Y) / StepCount);
BitBtn3.Left := Round(Btn3LT0.X + i * (Btn3LT.X - Btn3LT0.X) / StepCount);
BitBtn3.Top := Round(Btn3LT0.Y + i * (Btn3LT.Y - Btn3LT0.Y) / StepCount);
BitBtn4.Left := Round(Btn4LT0.X + i * (Btn4LT.X - Btn4LT0.X) / StepCount);
BitBtn4.Top := Round(Btn4LT0.Y + i * (Btn4LT.Y - Btn4LT0.Y) / StepCount);
BitBtn5.Left := Round(Btn5LT0.X + i * (Btn5LT.X - Btn5LT0.X) / StepCount);
BitBtn5.Top := Round(Btn5LT0.Y + i * (Btn5LT.Y - Btn5LT0.Y) / StepCount);
Application.ProcessMessages;
end;
Form2.Label1.Caption:='';
Form2.Panel1.Caption:='';
GroupBox7.Visible:=true;
GroupBox8.Visible:=true;
Table1.Filter:='Klas='''+'game''';
Table1.Filtered:=True;
end;
procedure TForm2.BitBtn4Click(Sender: TObject);
begin
Btn1LT0.X := BitBtn1.Left; Btn1LT0.Y := BitBtn1.Top;
Btn2LT0.X := BitBtn2.Left; Btn2LT0.Y := BitBtn2.Top;
Btn3LT0.X := BitBtn3.Left; Btn3LT0.Y := BitBtn3.Top;
Btn4LT0.X := BitBtn4.Left; Btn4LT0.Y := BitBtn4.Top;
Btn5LT0.X := BitBtn5.Left; Btn5LT0.Y := BitBtn5.Top;
Btn1LT.X := 16; Btn1LT.Y := 50;
Btn2LT.X := 16; Btn2LT.Y := 150;
Btn3LT.X := 16; Btn3LT.Y := 250;
Btn4LT.X := 16; Btn4LT.Y := 350;
Btn5LT.X := 16; Btn5LT.Y := 450;
for i := 1 to StepCount do
begin
BitBtn1.Left := Round(Btn1LT0.X + i * (Btn1LT.X - Btn1LT0.X) / StepCount);
BitBtn1.Top := Round(Btn1LT0.Y + i * (Btn1LT.Y - Btn1LT0.Y) / StepCount);
BitBtn2.Left := Round(Btn2LT0.X + i * (Btn2LT.X - Btn2LT0.X) / StepCount);
BitBtn2.Top := Round(Btn2LT0.Y + i * (Btn2LT.Y - Btn2LT0.Y) / StepCount);
BitBtn3.Left := Round(Btn3LT0.X + i * (Btn3LT.X - Btn3LT0.X) / StepCount);
BitBtn3.Top := Round(Btn3LT0.Y + i * (Btn3LT.Y - Btn3LT0.Y) / StepCount);
BitBtn4.Left := Round(Btn4LT0.X + i * (Btn4LT.X - Btn4LT0.X) / StepCount);
BitBtn4.Top := Round(Btn4LT0.Y + i * (Btn4LT.Y - Btn4LT0.Y) / StepCount);
BitBtn5.Left := Round(Btn5LT0.X + i * (Btn5LT.X - Btn5LT0.X) / StepCount);
BitBtn5.Top := Round(Btn5LT0.Y + i * (Btn5LT.Y - Btn5LT0.Y) / StepCount);
Application.ProcessMessages;
end;
Form2.Label1.Caption:='';
Form2.Panel1.Caption:='';
GroupBox7.Visible:=true;
GroupBox8.Visible:=true;
Table1.Filter:='Klas='''+'prog'';
Table1.Filtered:=True;
end;
end;
procedure TForm2.BitBtn5Click(Sender: TObject);
begin
Btn1LT0.X := BitBtn1.Left; Btn1LT0.Y := BitBtn1.Top;
Btn2LT0.X := BitBtn2.Left; Btn2LT0.Y := BitBtn2.Top;
Btn3LT0.X := BitBtn3.Left; Btn3LT0.Y := BitBtn3.Top;
Btn4LT0.X := BitBtn4.Left; Btn4LT0.Y := BitBtn4.Top;
Btn5LT0.X := BitBtn5.Left; Btn5LT0.Y := BitBtn5.Top;
Btn1LT.X := 16; Btn1LT.Y := 50;
Btn2LT.X := 16; Btn2LT.Y := 150;
Btn3LT.X := 16; Btn3LT.Y := 250;
Btn4LT.X := 16; Btn4LT.Y := 350;
Btn5LT.X := 16; Btn5LT.Y := 450;
for i := 1 to StepCount do
begin
BitBtn1.Left := Round(Btn1LT0.X + i * (Btn1LT.X - Btn1LT0.X) / StepCount);
BitBtn1.Top := Round(Btn1LT0.Y + i * (Btn1LT.Y - Btn1LT0.Y) / StepCount);
BitBtn2.Left := Round(Btn2LT0.X + i * (Btn2LT.X - Btn2LT0.X) / StepCount);
BitBtn2.Top := Round(Btn2LT0.Y + i * (Btn2LT.Y - Btn2LT0.Y) / StepCount);
BitBtn3.Left := Round(Btn3LT0.X + i * (Btn3LT.X - Btn3LT0.X) / StepCount);
BitBtn3.Top := Round(Btn3LT0.Y + i * (Btn3LT.Y - Btn3LT0.Y) / StepCount);
BitBtn4.Left := Round(Btn4LT0.X + i * (Btn4LT.X - Btn4LT0.X) / StepCount);
BitBtn4.Top := Round(Btn4LT0.Y + i * (Btn4LT.Y - Btn4LT0.Y) / StepCount);
BitBtn5.Left := Round(Btn5LT0.X + i * (Btn5LT.X - Btn5LT0.X) / StepCount);
BitBtn5.Top := Round(Btn5LT0.Y + i * (Btn5LT.Y - Btn5LT0.Y) / StepCount);
Application.ProcessMessages;
end;
Form2.Label1.Caption:='';
Form2.Panel1.Caption:='';
GroupBox7.Visible:=true;
GroupBox8.Visible:=true;
Table1.Filter:='Klas='''+'knigi''';
Table1.Filtered:=True;
end;
end;
а как проще написать чтоб работало? Данным способом работает, но тут одно и тоже повторяется
