unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Tabs,
Dialogs, ExtCtrls, frxDesgn, frxClass, StdCtrls, ToolWin, ComCtrls;
type
TForm3 =
class(TForm)
btn1: TButton;
frxreport: TfrxReport;
frxDesigner1: TfrxDesigner;
pnl1: TPanel;
procedure btn1Click(Sender: TObject);
procedure lst1DblClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form3: TForm3;
MyDesigner: TfrxCustomDesigner;
implementation
{$R *.dfm}
procedure TForm3.btn1Click(Sender: TObject);
var
Designer: TfrxDesignerForm;
cbb2: TComboBox;
tlb2: TToolBar;
MyTabs : TTabSet;
lb_Constanten: TListBox;
Pn_Constanten: TPanel;
x : Integer;
myClassname :
String;
mymemp : TfrxMemoView;
begin
MyDesigner := TfrxCustomDesigner(frxDesignerClass.NewInstance);
MyDesigner.CreateDesigner(
nil, frxReport);
frxReport.Designer := MyDesigner;
Designer := TfrxDesignerForm(frxReport.Designer);
cbb2 := TComboBox.Create(Self);
tlb2 := TToolBar.create(self);
tlb2.Parent:= Designer.DockTop;
cbb2.Parent := tlb2;
cbb2.Items.Add('
Anzahl');
cbb2.Items.Add('
Ausfuehrung');
cbb2.Items.Add('
Box');
cbb2.Items.Add('
Breite');
cbb2.Items.Add('
Durchmesser');
cbb2.Items.Add('
Waage');
lb_Constanten := TListBox.Create(self);
Pn_Constanten := TPanel.Create(Self);
Designer.Show;
for x := 0
to Designer.DataTree.ControlCount - 1
do
begin
myClassname := Designer.DataTree.Controls[x].ClassType.ClassName;
if myClassname = '
TTabSet'
then
begin
MyTabs := TTabSet(Designer.DataTree.Controls[x]);
Break;
end;
end;
Pn_Constanten.parent := Designer.DataTree.DataPn.parent;
Pn_Constanten.Align := Designer.DataTree.DataPn.Align;
Pn_Constanten.BoundsRect := Designer.DataTree.DataPn.BoundsRect ;
Pn_Constanten.Visible := False;
lb_Constanten.Parent := Pn_Constanten;
MyTabs.Tabs.AddObject('
TransLations', Pn_Constanten);
lb_Constanten.Items := cbb2.Items;
lb_Constanten.Align := alClient;
lb_Constanten.OnDblClick := lst1DblClick;
Designer.DataTree.UpdateItems;
end;
procedure TForm3.btn2Click(Sender: TObject);
begin
frxReport.DesignReport;
end;
procedure TForm3.lst1DblClick(Sender: TObject);
var
tranlateStr :
string;
myMemoView : TfrxMemoView;
myListBox : TListBox;
begin
if MyDesigner.SelectedObjects.Count > 1
then
begin
MessageDlg('
Bitte wählen Sie ein einzelnes MemoView aus.',
mtInformation, [mbOK], 0);
Exit;
end;
myListBox := TListBox(Sender);
tranlateStr := myListBox.Items[myListBox.ItemIndex] ;
try
myMemoView := MyDesigner.SelectedObjects.Items[0];
myMemoView.Text := '
TransLate[' + QuotedStr(tranlateStr) +'
]';
MyDesigner.Report.Designer.ReloadReport;
MyDesigner.SelectedObjects.Clear;
MyDesigner.SelectedObjects.Add(myMemoView) ;
except
MessageDlg('
Das einfügen ist nur iin MemoViews mäöglich',
mtInformation, [mbOK], 0);
end;
end;
end.