procedure TfrmParameters.AddParameter(const aCaption: string;
aParamType: TMyParamType; const aFinderKey: integer);
var
NewPanel: TPanel;
NewLabel: TLabel;
begin
if ParamList.IndexOf(UpperCase(aCaption))=-1 then
begin
ParamList.Add(Uppercase(aCaption));
end
else
Exit;
NewPanel := TPanel.Create(ParamBox);
with NewPanel do
begin
Parent := ParamBox;
Align := alBottom;
Height := 30;
Visible := True;
NewLabel := TLabel.Create(NewPanel);
NewLabel.Parent := NewPanel;
NewLabel.Left := 5;
NewLabel.Top := 7;
NewLabel.Caption := StrReplaceChar(aCaption,'_',' ');
NewLabel.Visible := True;
NewLabel.EllipsisPosition := epEndEllipsis;
NewLabel.Hint := NewLabel.Caption;
NewLabel.ShowHint := True;
case aParamType of
ftEdit: with TcxTextEdit.Create(NewPanel) do
begin
Parent := NewPanel;
Left := kField_Start_Pos;
Width := (NewPanel.Width - Left) - 5;
Anchors := Anchors + [akRight];
Visible := True;
Top := 5;
OnExit := UpdateParamValue;
Hint := aCaption;
end;
ftList: with TcxComboBox.Create(NewPanel) do
begin
Parent := NewPanel;
Left := kField_Start_Pos;
Width := (NewPanel.Width - Left) - 5;
Anchors := Anchors + [akRight];
Visible := True;
Top := 5;
with TcxComboBoxProperties(Properties) do
begin
Items.Clear;
items.Add('1');
items.add('2');
items.add('3');
end;
OnExit := UpdateParamValue;
Hint := aCaption;
end;
ftDate: with TcxDateEdit.Create(NewPanel) do
begin
Parent := NewPanel;
Left := kField_Start_Pos;
Width := (NewPanel.Width - Left) - 5;
Anchors := Anchors + [akRight];
Visible := True;
Top := 5;
with TcxDateEditProperties(Properties) do
begin
ShowTime := False;
end;
OnExit := UpdateParamValue;
Hint := aCaption;
end;
ftCopies: with TcxSpinEdit.Create(NewPanel) do
begin
Parent := NewPanel;
Left := kField_Start_Pos;
Width := (NewPanel.Width - Left) - 5;
Anchors := Anchors + [akRight];
Visible := True;
Top := 5;
OnExit := UpdateNumberOfCopies;
Hint := aCaption;
with TcxSpinEditProperties(Properties) do
begin
MinValue := 1;
AssignedValues.MinValue := True;
end;
end;
end;
Align := alTop; //see if it appears under the previous item
end;
end;