mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 22:19:18 +02:00
LazReport, combobox to select objects in report designer from Domingo Alvarez Duarte, issue #14782
git-svn-id: trunk@27864 -
This commit is contained in:
parent
00dd093d5d
commit
fe03967bf5
@ -3,6 +3,7 @@ The following people contributed to LazReport :
|
|||||||
Aleksey Lagunov (ru)
|
Aleksey Lagunov (ru)
|
||||||
Andrey Gusev (ru)
|
Andrey Gusev (ru)
|
||||||
Christian Ulrich (de)
|
Christian Ulrich (de)
|
||||||
|
Domingo Alvarez Duarte( )
|
||||||
German Basisty (ar)
|
German Basisty (ar)
|
||||||
Javier Villarroya (es)
|
Javier Villarroya (es)
|
||||||
Jesus Reyes A. (mx)
|
Jesus Reyes A. (mx)
|
||||||
@ -12,6 +13,6 @@ Luiz Americo (br)
|
|||||||
Mattias Gaertner (de)
|
Mattias Gaertner (de)
|
||||||
Olivier Guilbaud (fr)
|
Olivier Guilbaud (fr)
|
||||||
Petr Smolik (cz)
|
Petr Smolik (cz)
|
||||||
Ts. Petrov ( )
|
Ts. Petrov ( )
|
||||||
Vincent Snijders (nl)
|
Vincent Snijders (nl)
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ type
|
|||||||
private
|
private
|
||||||
fPropertyGrid : TCustomPropertiesGrid;
|
fPropertyGrid : TCustomPropertiesGrid;
|
||||||
{$IFNDEF EXTOI}
|
{$IFNDEF EXTOI}
|
||||||
|
fcboxObjList : TComboBox;
|
||||||
fBtn,fBtn2 : TButton;
|
fBtn,fBtn2 : TButton;
|
||||||
fPanelHeader : TPanel;
|
fPanelHeader : TPanel;
|
||||||
fLastHeight : Word;
|
fLastHeight : Word;
|
||||||
@ -118,12 +119,14 @@ type
|
|||||||
procedure DoHide; override;
|
procedure DoHide; override;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
procedure DoOnResize; override;
|
procedure DoOnResize; override;
|
||||||
|
procedure DoSetSizes;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
public
|
public
|
||||||
constructor Create(aOwner : TComponent); override;
|
constructor Create(aOwner : TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure Select(Obj: TObject);
|
procedure Select(Obj: TObject);
|
||||||
|
procedure cboxObjListOnChanged(Sender: TObject);
|
||||||
procedure SetModifiedEvent(AEvent: TNotifyEvent);
|
procedure SetModifiedEvent(AEvent: TNotifyEvent);
|
||||||
procedure Refresh;
|
procedure Refresh;
|
||||||
end;
|
end;
|
||||||
@ -6299,36 +6302,56 @@ end;
|
|||||||
procedure TfrObjectInspector.DoOnResize;
|
procedure TfrObjectInspector.DoOnResize;
|
||||||
begin
|
begin
|
||||||
inherited DoOnResize;
|
inherited DoOnResize;
|
||||||
|
|
||||||
if not (Assigned(fPanelHeader) or Assigned(fBtn) or Assigned(fPropertyGrid)) then
|
if not (Assigned(fPanelHeader) or Assigned(fBtn) or Assigned(fPropertyGrid)) then
|
||||||
Exit;
|
Exit;
|
||||||
|
DoSetSizes
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrObjectInspector.DoSetSizes;
|
||||||
|
var
|
||||||
|
iLeft, iWidth: integer;
|
||||||
|
begin
|
||||||
|
iLeft := 5;
|
||||||
|
iWidth := Self.Width-10;
|
||||||
|
|
||||||
with fPanelHeader do
|
with fPanelHeader do
|
||||||
begin
|
begin
|
||||||
Height:=18;
|
Height:=18;
|
||||||
Left :=5;
|
Left :=iLeft;
|
||||||
Top :=5;
|
Top :=5;
|
||||||
Width :=Self.Width-10;
|
Width :=iWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with fBtn2 do
|
with fBtn2 do
|
||||||
begin
|
begin
|
||||||
Left :=fPanelHeader.Width-14;
|
Left :=fPanelHeader.Width-14;
|
||||||
Top :=1;
|
Top :=1;
|
||||||
|
Height :=15;
|
||||||
|
Width :=15;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with fBtn do
|
with fBtn do
|
||||||
begin
|
begin
|
||||||
Left :=fPanelHeader.Width-30;
|
Left :=fPanelHeader.Width-30;
|
||||||
Top :=1;
|
Top :=1;
|
||||||
|
Height :=15;
|
||||||
|
Width :=15;
|
||||||
|
end;
|
||||||
|
|
||||||
|
with fcboxObjList do
|
||||||
|
begin
|
||||||
|
Left :=iLeft;
|
||||||
|
Top :=fPanelHeader.Top+fPanelHeader.Height+1;
|
||||||
|
Height:=18;
|
||||||
|
Width :=iWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with fPropertyGrid do
|
with fPropertyGrid do
|
||||||
begin
|
begin
|
||||||
Left :=5;
|
Left :=iLeft;
|
||||||
Top :=fPanelHeader.Top+fPanelHeader.Height+1;
|
Top :=fcboxObjList.Top+fcboxObjList.Height+2;
|
||||||
Width :=Self.Width-10;
|
Width :=iWidth;
|
||||||
Height:=self.Height-(fPanelHeader.Top+fPanelHeader.Height)-5;
|
Height:=self.Height-(fcboxObjList.Top+fcboxObjList.Height)-5;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -6339,7 +6362,7 @@ begin
|
|||||||
|
|
||||||
{$IFDEF EXTOI}
|
{$IFDEF EXTOI}
|
||||||
Width :=220;
|
Width :=220;
|
||||||
Height :=250;
|
Height :=300;
|
||||||
Top :=Screen.Height div 2;
|
Top :=Screen.Height div 2;
|
||||||
Left :=40;
|
Left :=40;
|
||||||
Visible :=False;
|
Visible :=False;
|
||||||
@ -6359,8 +6382,8 @@ begin
|
|||||||
|
|
||||||
Parent :=TWinControl(aOwner);
|
Parent :=TWinControl(aOwner);
|
||||||
Width :=220;
|
Width :=220;
|
||||||
Height :=250;
|
Height :=300;
|
||||||
Top :=40;
|
Top :=120;
|
||||||
Left :=40;
|
Left :=40;
|
||||||
Borderstyle :=bsNone;
|
Borderstyle :=bsNone;
|
||||||
BevelInner :=bvLowered;
|
BevelInner :=bvLowered;
|
||||||
@ -6374,10 +6397,6 @@ begin
|
|||||||
with fPanelHeader do
|
with fPanelHeader do
|
||||||
begin
|
begin
|
||||||
Parent:=Self;
|
Parent:=Self;
|
||||||
Height:=18;
|
|
||||||
Left :=5;
|
|
||||||
Top :=5;
|
|
||||||
Width :=240-10;
|
|
||||||
Color :=clSilver;
|
Color :=clSilver;
|
||||||
BorderStyle:=bsNone;
|
BorderStyle:=bsNone;
|
||||||
BevelInner:=bvNone;
|
BevelInner:=bvNone;
|
||||||
@ -6394,10 +6413,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
Parent:=fPanelHeader;
|
Parent:=fPanelHeader;
|
||||||
Caption:='-';
|
Caption:='-';
|
||||||
Height :=15;
|
|
||||||
Width :=15;
|
|
||||||
Left :=fPanelHeader.Width-30;
|
|
||||||
Top :=1;
|
|
||||||
TabStop:=False;
|
TabStop:=False;
|
||||||
OnClick:=@BtnClick;
|
OnClick:=@BtnClick;
|
||||||
end;
|
end;
|
||||||
@ -6407,27 +6422,29 @@ begin
|
|||||||
begin
|
begin
|
||||||
Parent:=fPanelHeader;
|
Parent:=fPanelHeader;
|
||||||
Caption:='x';
|
Caption:='x';
|
||||||
Height :=15;
|
|
||||||
Width :=15;
|
|
||||||
Left :=fPanelHeader.Width-14;
|
|
||||||
Top :=1;
|
|
||||||
TabStop:=False;
|
TabStop:=False;
|
||||||
OnClick:=@BtnClick;
|
OnClick:=@BtnClick;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
fcboxObjList := TComboBox.Create(Self);
|
||||||
|
with fcboxObjList do
|
||||||
|
begin
|
||||||
|
Parent:=Self;
|
||||||
|
ShowHint:=false; //cause problems in windows
|
||||||
|
Onchange := @cboxObjListOnChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
// create the ObjectInspector
|
// create the ObjectInspector
|
||||||
fPropertyGrid:=TCustomPropertiesGrid.Create(aOwner);
|
fPropertyGrid:=TCustomPropertiesGrid.Create(aOwner);
|
||||||
with fPropertyGrid do
|
with fPropertyGrid do
|
||||||
begin
|
begin
|
||||||
Name :='PropertyGrid';
|
Name :='PropertyGrid';
|
||||||
Parent:=Self;
|
Parent:=Self;
|
||||||
Left :=5;
|
|
||||||
Top :=fPanelHeader.Top+fPanelHeader.Height+1;
|
|
||||||
Width :=240-10;
|
|
||||||
Height:=self.Height-(fPanelHeader.Top+fPanelHeader.Height)-5;
|
|
||||||
ShowHint:=false; //cause problems in windows
|
ShowHint:=false; //cause problems in windows
|
||||||
fPropertyGrid.SaveOnChangeTIObject:=false;
|
fPropertyGrid.SaveOnChangeTIObject:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
DoSetSizes;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6441,9 +6458,21 @@ procedure TfrObjectInspector.Select(Obj: TObject);
|
|||||||
var
|
var
|
||||||
i : Integer;
|
i : Integer;
|
||||||
NewSel : TPersistentSelectionList;
|
NewSel : TPersistentSelectionList;
|
||||||
|
frDsg: TfrDesignerForm;
|
||||||
begin
|
begin
|
||||||
|
if Objects.Count <> fcboxObjList.Items.Count then
|
||||||
|
begin
|
||||||
|
fcboxObjList.Clear;
|
||||||
|
for i:=0 to Objects.Count-1 do
|
||||||
|
fcboxObjList.AddItem(TfrView(Objects[i]).Name, TObject(Objects[i]));
|
||||||
|
end;
|
||||||
|
|
||||||
if (Obj=nil) or (Obj is TPersistent) then
|
if (Obj=nil) or (Obj is TPersistent) then
|
||||||
fPropertyGrid.TIObject := TPersistent(Obj)
|
begin
|
||||||
|
fPropertyGrid.TIObject := TPersistent(Obj);
|
||||||
|
if Obj <> nil then
|
||||||
|
fcboxObjList.ItemIndex := fcboxObjList.Items.IndexOfObject(Obj);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if Obj is TFpList then
|
if Obj is TFpList then
|
||||||
with TFpList(Obj) do
|
with TFpList(Obj) do
|
||||||
@ -6460,6 +6489,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrObjectInspector.cboxObjListOnChanged(Sender: TObject);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
vObj: TObject;
|
||||||
|
begin
|
||||||
|
if fcboxObjList.ItemIndex >= 0 then
|
||||||
|
begin
|
||||||
|
SelNum := 0;
|
||||||
|
for i := 0 to Objects.Count - 1 do
|
||||||
|
TfrView(Objects[i]).Selected := False;
|
||||||
|
vObj := fcboxObjList.Items.Objects[fcboxObjList.ItemIndex];
|
||||||
|
if vObj is TfrView then
|
||||||
|
begin
|
||||||
|
TfrView(vObj).Selected:=True;
|
||||||
|
SelNum := 1;
|
||||||
|
frDesigner.Invalidate;
|
||||||
|
end;
|
||||||
|
Select(vObj);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrObjectInspector.SetModifiedEvent(AEvent: TNotifyEvent);
|
procedure TfrObjectInspector.SetModifiedEvent(AEvent: TNotifyEvent);
|
||||||
begin
|
begin
|
||||||
fPropertyGrid.OnModified:=AEvent;
|
fPropertyGrid.OnModified:=AEvent;
|
||||||
|
Loading…
Reference in New Issue
Block a user