diff --git a/components/rtticontrols/examples/example1.lfm b/components/rtticontrols/examples/example1.lfm
index 732fbf6fbc..2de2d26c2d 100644
--- a/components/rtticontrols/examples/example1.lfm
+++ b/components/rtticontrols/examples/example1.lfm
@@ -1,15 +1,15 @@
object Form1: TForm1
ActiveControl = TIEdit1
Caption = 'RTTI Controls Example'
- ClientHeight = 357
- ClientWidth = 590
+ ClientHeight = 392
+ ClientWidth = 619
PixelsPerInch = 90
- HorzScrollBar.Page = 591
- VertScrollBar.Page = 358
- Left = 291
- Height = 357
- Top = 163
- Width = 590
+ HorzScrollBar.Page = 620
+ VertScrollBar.Page = 393
+ Left = 294
+ Height = 392
+ Top = 168
+ Width = 619
object TIEdit1: TTIEdit
Link.TIObject = TICheckBox1
Link.TIPropertyName = 'Caption'
@@ -30,9 +30,9 @@ object Form1: TForm1
TabOrder = 1
TabStop = True
Left = 176
- Height = 20
+ Height = 24
Top = 136
- Width = 109
+ Width = 98
end
object TIListBox_Color: TTIListBox
BorderStyle = bsSingle
@@ -41,6 +41,7 @@ object Form1: TForm1
Link.TIPropertyName = 'Color'
TabOrder = 2
TabStop = True
+ TopIndex = -1
Left = 11
Height = 70
Top = 200
@@ -103,9 +104,9 @@ object Form1: TForm1
Tabstop = True
TIObject = StaticText4
ValueFont.Color = clMaroon
- Left = 312
+ Left = 328
Height = 225
- Top = 119
+ Top = 144
Width = 242
end
object Label1: TLabel
@@ -116,4 +117,18 @@ object Form1: TForm1
Top = 9
Width = 286
end
+ object TICheckBox2: TTICheckBox
+ AllowGrayed = True
+ AutoSize = True
+ Caption = 'TICheckBox2 for set element TIPropertyGrid1.Anchors.akRight'
+ Link.TIObject = TIPropertyGrid1
+ Link.TIPropertyName = 'Anchors'
+ Link.TIElementName = 'akRight'
+ TabOrder = 10
+ TabStop = True
+ Left = 240
+ Height = 24
+ Top = 104
+ Width = 368
+ end
end
diff --git a/components/rtticontrols/examples/example1.lrs b/components/rtticontrols/examples/example1.lrs
index 25775ebe2d..496824ae41 100644
--- a/components/rtticontrols/examples/example1.lrs
+++ b/components/rtticontrols/examples/example1.lrs
@@ -2,37 +2,42 @@
LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#13'ActiveControl'#7#7'TIEdit1'#7'Caption'#6#21'RTTI'
- +' Controls Example'#12'ClientHeight'#3'e'#1#11'ClientWidth'#3'N'#2#13'Pixels'
- +'PerInch'#2'Z'#18'HorzScrollBar.Page'#3'O'#2#18'VertScrollBar.Page'#3'f'#1#4
- +'Left'#3'#'#1#6'Height'#3'e'#1#3'Top'#3#163#0#5'Width'#3'N'#2#0#7'TTIEdit'#7
- +'TIEdit1'#13'Link.TIObject'#7#11'TICheckBox1'#19'Link.TIPropertyName'#6#7'Ca'
- +'ption'#7'TabStop'#9#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2#23#3'Top'#3#136
- +#0#5'Width'#3#144#0#0#0#11'TTICheckBox'#11'TICheckBox1'#11'AllowGrayed'#9#8
- +'AutoSize'#9#7'Caption'#6#11'TICheckBox1'#13'Link.TIObject'#7#7'TIEdit1'#19
+ +' Controls Example'#12'ClientHeight'#3#136#1#11'ClientWidth'#3'k'#2#13'Pixel'
+ +'sPerInch'#2'Z'#18'HorzScrollBar.Page'#3'l'#2#18'VertScrollBar.Page'#3#137#1
+ +#4'Left'#3'&'#1#6'Height'#3#136#1#3'Top'#3#168#0#5'Width'#3'k'#2#0#7'TTIEdit'
+ +#7'TIEdit1'#13'Link.TIObject'#7#11'TICheckBox1'#19'Link.TIPropertyName'#6#7
+ +'Caption'#7'TabStop'#9#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2#23#3'Top'#3
+ +#136#0#5'Width'#3#144#0#0#0#11'TTICheckBox'#11'TICheckBox1'#11'AllowGrayed'#9
+ +#8'AutoSize'#9#7'Caption'#6#11'TICheckBox1'#13'Link.TIObject'#7#7'TIEdit1'#19
+'Link.TIPropertyName'#6#7'Visible'#5'State'#7#9'cbChecked'#8'TabOrder'#2#1#7
- +'TabStop'#9#4'Left'#3#176#0#6'Height'#2#20#3'Top'#3#136#0#5'Width'#2'm'#0#0
+ +'TabStop'#9#4'Left'#3#176#0#6'Height'#2#24#3'Top'#3#136#0#5'Width'#2'b'#0#0
+#10'TTIListBox'#15'TIListBox_Color'#11'BorderStyle'#7#8'bsSingle'#16'ClickOn'
+'SelChange'#8#13'Link.TIObject'#7#11'StaticText1'#19'Link.TIPropertyName'#6#5
- +'Color'#8'TabOrder'#2#2#7'TabStop'#9#4'Left'#2#11#6'Height'#2'F'#3'Top'#3#200
- +#0#5'Width'#2'u'#0#0#11'TStaticText'#11'StaticText1'#7'Caption'#6'!Edit capt'
- +'ion of right TTICheckbox'#5'Color'#7#7'clOlive'#8'TabOrder'#2#3#7'TabStop'#9
- +#4'Left'#2#8#6'Height'#2#17#3'Top'#2'p'#5'Width'#3#193#0#0#0#11'TStaticText'
- +#11'StaticText2'#7'Caption'#6#31'Edit Color of above TStaticText'#11'ParentC'
- +'olor'#9#8'TabOrder'#2#4#7'TabStop'#9#4'Left'#2#11#6'Height'#2#17#3'Top'#3
- +#176#0#5'Width'#3#194#0#0#0#11'TTIComboBox'#18'TIComboBox_Enabled'#13'Link.T'
- +'IObject'#7#11'TICheckBox1'#19'Link.TIPropertyName'#6#7'Enabled'#9'MaxLength'
- +#2#0#8'TabOrder'#2#5#7'TabStop'#9#4'Left'#2#16#6'Height'#2#25#3'Top'#3'2'#1#5
- +'Width'#3#180#0#0#0#11'TStaticText'#11'StaticText3'#7'Caption'#6#25'Edit TTI'
- +'CheckBox1.Enabled'#11'ParentColor'#9#8'TabOrder'#2#6#7'TabStop'#9#4'Left'#2
- +#15#6'Height'#2#17#3'Top'#3#27#1#5'Width'#3#186#0#0#0#11'TStaticText'#11'Sta'
- +'ticText4'#7'Caption'#6'4Edit this TStaticText with the TTIPropertyGrid belo'
- +'w'#11'ParentColor'#9#8'TabOrder'#2#7#7'TabStop'#9#4'Left'#3'`'#1#6'Height'#2
- +'P'#3'Top'#2#16#5'Width'#3#145#0#0#0#15'TTIPropertyGrid'#15'TIPropertyGrid1'
- +#11'BorderStyle'#7#8'bsSingle'#22'DefaultValueFont.Color'#7#15'clActiveCapti'
- +'on'#7'Tabstop'#9#8'TIObject'#7#11'StaticText4'#15'ValueFont.Color'#7#8'clMa'
- +'roon'#4'Left'#3'8'#1#6'Height'#3#225#0#3'Top'#2'w'#5'Width'#3#242#0#0#0#6'T'
- +'Label'#6'Label1'#7'Caption'#6#156'This is a demonstration of a few RTTI Con'
- +'trols.'#10'The RTTI controls allows you to edit properties of objects.'#10
- +'The whole example requires not one line of code.'#8'WordWrap'#9#4'Left'#2#10
- +#6'Height'#2'W'#3'Top'#2#9#5'Width'#3#30#1#0#0#0
+ +'Color'#8'TabOrder'#2#2#7'TabStop'#9#8'TopIndex'#2#255#4'Left'#2#11#6'Height'
+ +#2'F'#3'Top'#3#200#0#5'Width'#2'u'#0#0#11'TStaticText'#11'StaticText1'#7'Cap'
+ +'tion'#6'!Edit caption of right TTICheckbox'#5'Color'#7#7'clOlive'#8'TabOrde'
+ +'r'#2#3#7'TabStop'#9#4'Left'#2#8#6'Height'#2#17#3'Top'#2'p'#5'Width'#3#193#0
+ +#0#0#11'TStaticText'#11'StaticText2'#7'Caption'#6#31'Edit Color of above TSt'
+ +'aticText'#11'ParentColor'#9#8'TabOrder'#2#4#7'TabStop'#9#4'Left'#2#11#6'Hei'
+ +'ght'#2#17#3'Top'#3#176#0#5'Width'#3#194#0#0#0#11'TTIComboBox'#18'TIComboBox'
+ +'_Enabled'#13'Link.TIObject'#7#11'TICheckBox1'#19'Link.TIPropertyName'#6#7'E'
+ +'nabled'#9'MaxLength'#2#0#8'TabOrder'#2#5#7'TabStop'#9#4'Left'#2#16#6'Height'
+ +#2#25#3'Top'#3'2'#1#5'Width'#3#180#0#0#0#11'TStaticText'#11'StaticText3'#7'C'
+ +'aption'#6#25'Edit TTICheckBox1.Enabled'#11'ParentColor'#9#8'TabOrder'#2#6#7
+ +'TabStop'#9#4'Left'#2#15#6'Height'#2#17#3'Top'#3#27#1#5'Width'#3#186#0#0#0#11
+ +'TStaticText'#11'StaticText4'#7'Caption'#6'4Edit this TStaticText with the T'
+ +'TIPropertyGrid below'#11'ParentColor'#9#8'TabOrder'#2#7#7'TabStop'#9#4'Left'
+ +#3'`'#1#6'Height'#2'P'#3'Top'#2#16#5'Width'#3#145#0#0#0#15'TTIPropertyGrid'
+ +#15'TIPropertyGrid1'#11'BorderStyle'#7#8'bsSingle'#22'DefaultValueFont.Color'
+ +#7#15'clActiveCaption'#7'Tabstop'#9#8'TIObject'#7#11'StaticText4'#15'ValueFo'
+ +'nt.Color'#7#8'clMaroon'#4'Left'#3'H'#1#6'Height'#3#225#0#3'Top'#3#144#0#5'W'
+ +'idth'#3#242#0#0#0#6'TLabel'#6'Label1'#7'Caption'#6#156'This is a demonstrat'
+ +'ion of a few RTTI Controls.'#10'The RTTI controls allows you to edit proper'
+ +'ties of objects.'#10'The whole example requires not one line of code.'#8'Wo'
+ +'rdWrap'#9#4'Left'#2#10#6'Height'#2'W'#3'Top'#2#9#5'Width'#3#30#1#0#0#11'TTI'
+ +'CheckBox'#11'TICheckBox2'#11'AllowGrayed'#9#8'AutoSize'#9#7'Caption'#6';TIC'
+ +'heckBox2 for set element TIPropertyGrid1.Anchors.akRight'#13'Link.TIObject'
+ +#7#15'TIPropertyGrid1'#19'Link.TIPropertyName'#6#7'Anchors'#18'Link.TIElemen'
+ +'tName'#6#7'akRight'#8'TabOrder'#2#10#7'TabStop'#9#4'Left'#3#240#0#6'Height'
+ +#2#24#3'Top'#2'h'#5'Width'#3'p'#1#0#0#0
]);
diff --git a/components/rtticontrols/examples/example1.pas b/components/rtticontrols/examples/example1.pas
index 10f0ab52de..c9afa16712 100644
--- a/components/rtticontrols/examples/example1.pas
+++ b/components/rtticontrols/examples/example1.pas
@@ -34,6 +34,7 @@ type
StaticText3: TStaticText;
StaticText4: TStaticText;
TICheckBox1: TTICheckBox;
+ TICheckBox2: TTICheckBox;
TIComboBox_Enabled: TTIComboBox;
TIEdit1: TTIEdit;
TIListBox_Color: TTIListBox;
diff --git a/components/rtticontrols/examples/example2.lfm b/components/rtticontrols/examples/example2.lfm
index bf1b6c6bbe..4526bdaffa 100644
--- a/components/rtticontrols/examples/example2.lfm
+++ b/components/rtticontrols/examples/example2.lfm
@@ -1,26 +1,26 @@
object Form1: TForm1
Caption = 'Form1'
- ClientHeight = 300
- ClientWidth = 400
+ ClientHeight = 410
+ ClientWidth = 350
OnCreate = Form1Create
OnDestroy = Form1Destroy
PixelsPerInch = 90
- HorzScrollBar.Page = 401
- VertScrollBar.Page = 301
+ HorzScrollBar.Page = 351
+ VertScrollBar.Page = 411
Left = 273
- Height = 300
+ Height = 410
Top = 181
- Width = 400
+ Width = 350
object GroupBox1: TGroupBox
Caption = 'MyString'
ClientHeight = 31
- ClientWidth = 331
+ ClientWidth = 296
ParentColor = True
TabOrder = 0
Left = 24
Height = 48
Top = 16
- Width = 335
+ Width = 300
object TIEdit1: TTIEdit
TabStop = True
TabOrder = 0
@@ -37,18 +37,18 @@ object Form1: TForm1
Left = 25
Height = 57
Top = 72
- Width = 338
+ Width = 300
end
object GroupBox2: TGroupBox
Caption = 'MyRange'
ClientHeight = 24
- ClientWidth = 335
+ ClientWidth = 296
ParentColor = True
TabOrder = 2
Left = 25
Height = 41
Top = 144
- Width = 339
+ Width = 300
object TITrackBar1: TTITrackBar
ScalePos = trTop
TabOrder = 0
@@ -66,6 +66,6 @@ object Form1: TForm1
Left = 27
Height = 87
Top = 199
- Width = 338
+ Width = 300
end
end
diff --git a/components/rtticontrols/examples/example2.lrs b/components/rtticontrols/examples/example2.lrs
index 98bb39ebfe..01bf8549e8 100644
--- a/components/rtticontrols/examples/example2.lrs
+++ b/components/rtticontrols/examples/example2.lrs
@@ -1,21 +1,21 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[
- 'TPF0'#6'TForm1'#5'Form1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3','#1#11'Cl'
- +'ientWidth'#3#144#1#8'OnCreate'#7#11'Form1Create'#9'OnDestroy'#7#12'Form1Des'
- +'troy'#13'PixelsPerInch'#2'Z'#18'HorzScrollBar.Page'#3#145#1#18'VertScrollBa'
- +'r.Page'#3'-'#1#4'Left'#3#17#1#6'Height'#3','#1#3'Top'#3#181#0#5'Width'#3#144
+ 'TPF0'#6'TForm1'#5'Form1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3#154#1#11'C'
+ +'lientWidth'#3'^'#1#8'OnCreate'#7#11'Form1Create'#9'OnDestroy'#7#12'Form1Des'
+ +'troy'#13'PixelsPerInch'#2'Z'#18'HorzScrollBar.Page'#3'_'#1#18'VertScrollBar'
+ +'.Page'#3#155#1#4'Left'#3#17#1#6'Height'#3#154#1#3'Top'#3#181#0#5'Width'#3'^'
+#1#0#9'TGroupBox'#9'GroupBox1'#7'Caption'#6#8'MyString'#12'ClientHeight'#2#31
- +#11'ClientWidth'#3'K'#1#11'ParentColor'#9#8'TabOrder'#2#0#4'Left'#2#24#6'Hei'
- +'ght'#2'0'#3'Top'#2#16#5'Width'#3'O'#1#0#7'TTIEdit'#7'TIEdit1'#7'TabStop'#9#8
+ +#11'ClientWidth'#3'('#1#11'ParentColor'#9#8'TabOrder'#2#0#4'Left'#2#24#6'Hei'
+ +'ght'#2'0'#3'Top'#2#16#5'Width'#3','#1#0#7'TTIEdit'#7'TIEdit1'#7'TabStop'#9#8
+'TabOrder'#2#0#4'Left'#2#23#6'Height'#2#23#3'Top'#2#1#5'Width'#3'#'#1#0#0#0
+#13'TTIRadioGroup'#13'TIRadioGroup1'#7'Caption'#6#6'MyEnum'#7'Columns'#2#3#11
- +'ParentColor'#9#4'Left'#2#25#6'Height'#2'9'#3'Top'#2'H'#5'Width'#3'R'#1#0#0#9
+ +'ParentColor'#9#4'Left'#2#25#6'Height'#2'9'#3'Top'#2'H'#5'Width'#3','#1#0#0#9
+'TGroupBox'#9'GroupBox2'#7'Caption'#6#7'MyRange'#12'ClientHeight'#2#24#11'Cl'
- +'ientWidth'#3'O'#1#11'ParentColor'#9#8'TabOrder'#2#2#4'Left'#2#25#6'Height'#2
- +')'#3'Top'#3#144#0#5'Width'#3'S'#1#0#11'TTITrackBar'#11'TITrackBar1'#8'Scale'
+ +'ientWidth'#3'('#1#11'ParentColor'#9#8'TabOrder'#2#2#4'Left'#2#25#6'Height'#2
+ +')'#3'Top'#3#144#0#5'Width'#3','#1#0#11'TTITrackBar'#11'TITrackBar1'#8'Scale'
+'Pos'#7#5'trTop'#8'TabOrder'#2#0#7'TabStop'#9#8'ScalePos'#7#5'trTop'#4'Left'
+#2#15#6'Height'#2#20#3'Top'#2#1#5'Width'#3')'#1#0#0#0#5'TMemo'#5'Memo1'#10'S'
+'crollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#3#4'Left'#2#27#6'Height'#2'W'#3'T'
- +'op'#3#199#0#5'Width'#3'R'#1#0#0#0
+ +'op'#3#199#0#5'Width'#3','#1#0#0#0
]);
diff --git a/components/rtticontrols/examples/exampleproject1.lpi b/components/rtticontrols/examples/exampleproject1.lpi
index 451b70d2aa..5f2e0a7274 100644
--- a/components/rtticontrols/examples/exampleproject1.lpi
+++ b/components/rtticontrols/examples/exampleproject1.lpi
@@ -9,53 +9,121 @@
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -65,23 +133,23 @@
-
+
-
+
-
+
-
+
@@ -104,6 +172,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/components/rtticontrols/examples/exampleproject2.lpi b/components/rtticontrols/examples/exampleproject2.lpi
index ff56710965..93dfb66375 100644
--- a/components/rtticontrols/examples/exampleproject2.lpi
+++ b/components/rtticontrols/examples/exampleproject2.lpi
@@ -3,27 +3,25 @@
+
+
+
+
-
-
-
-
-
-
-
+
-
+
-
+
@@ -32,31 +30,8 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/components/rtticontrols/rttictrls.pas b/components/rtticontrols/rttictrls.pas
index 869620755a..1e0693f317 100644
--- a/components/rtticontrols/rttictrls.pas
+++ b/components/rtticontrols/rttictrls.pas
@@ -22,6 +22,8 @@
ToDo:
- ploReadOnly
+ - TTICheckBox with Enums (e.g. TTICheckBox.Checked = Enum property has the
+ same value as TIElementName)
}
unit RTTICtrls;
@@ -100,12 +102,14 @@ Type
FOptions: TPropertyLinkOptions;
FOwner: TComponent;
FSaveEnabled: boolean;
+ FTIElementName: string;
FTIObject: TPersistent;
FTIPropertyName: string;
procedure SetCollectValues(const AValue: boolean);
procedure SetEditor(const AValue: TPropertyEditor);
procedure SetFilter(const AValue: TTypeKinds);
procedure SetOptions(const NewOptions: TPropertyLinkOptions);
+ procedure SetTIElementName(const AValue: string);
procedure SetTIObject(const AValue: TPersistent);
procedure SetTIPropertyName(const AValue: string);
protected
@@ -126,6 +130,8 @@ Type
procedure Assign(Source: TPersistent); override;
procedure SetObjectAndProperty(NewPersistent: TPersistent;
const NewPropertyName: string);
+ procedure SetObjectAndProperty(NewPersistent: TPersistent;
+ const NewPropertyName, NewElementName: string);
procedure InvalidateEditor; virtual;
procedure CreateEditor; virtual;
procedure FetchValues; virtual;
@@ -176,6 +182,7 @@ Type
property SaveEnabled: boolean read FSaveEnabled write FSaveEnabled;
property TIObject: TPersistent read FTIObject write SetTIObject;
property TIPropertyName: string read FTIPropertyName write SetTIPropertyName;
+ property TIElementName: string read FTIElementName write SetTIElementName;
end;
@@ -187,6 +194,7 @@ Type
property Options;
property TIObject;
property TIPropertyName;
+ property TIElementName;
end;
@@ -198,6 +206,12 @@ Type
end;
+ { TTIObjectPropertyEditor }
+
+ TTIObjectPropertyEditor = class(TPersistentPropertyEditor)
+ end;
+
+
{ TPropertyNamePropertyEditor
Property editor for TCustomPropertyLink.TIPropertyName, showing
all compatible properties. }
@@ -214,9 +228,21 @@ Type
end;
- { TTIObjectPropertyEditor }
+ { TTIElementNamePropertyEditor
+ Property editor for TCustomPropertyLink.TIElementName, showing
+ all elements. }
- TTIObjectPropertyEditor = class(TPersistentPropertyEditor)
+ TTIElementNamePropertyEditor = class(TStringPropertyEditor)
+ protected
+ FPropEdits: TList; // list of TPropertyEditor for TIPropertyName
+ FElementPropEdits: TList; // list of TPropertyEditor for TIElementName
+ procedure GetCompatiblePropEdits(Prop: TPropertyEditor);
+ procedure GetElementPropEdits(Prop: TPropertyEditor);
+ function TestEditor(const Prop: TPropertyEditor): boolean;
+ public
+ function GetAttributes: TPropertyAttributes; override;
+ function GetEditLimit: Integer; override;
+ procedure GetValues(Proc: TGetStringProc); override;
end;
@@ -710,7 +736,6 @@ Type
procedure LinkLoadFromProperty(Sender: TObject); virtual;
procedure LinkSaveToProperty(Sender: TObject); virtual;
procedure LinkEditorChanged(Sender: TObject); virtual;
- procedure DoAutoSize; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@@ -1390,6 +1415,12 @@ begin
if (ploReadOnIdle in ChangedOptions) then UpdateIdleHandler;
end;
+procedure TCustomPropertyLink.SetTIElementName(const AValue: string);
+begin
+ if FTIElementName=AValue then exit;
+ SetObjectAndProperty(TIObject,TIPropertyName,AValue);
+end;
+
function TCustomPropertyLink.GetCanModify: boolean;
begin
Result:=(FEditor<>nil) and (not FEditor.IsReadOnly);
@@ -1398,13 +1429,13 @@ end;
procedure TCustomPropertyLink.SetTIObject(const AValue: TPersistent);
begin
if FTIObject=AValue then exit;
- SetObjectAndProperty(AValue,TIPropertyName);
+ SetObjectAndProperty(AValue,TIPropertyName,TIElementName);
end;
procedure TCustomPropertyLink.SetTIPropertyName(const AValue: string);
begin
if FTIPropertyName=AValue then exit;
- SetObjectAndProperty(TIObject,AValue);
+ SetObjectAndProperty(TIObject,AValue,TIElementName);
end;
procedure TCustomPropertyLink.EditorChanged;
@@ -1460,7 +1491,8 @@ var
begin
if Source is TCustomPropertyLink then begin
SrcLink:=TCustomPropertyLink(Source);
- SetObjectAndProperty(SrcLink.TIObject,SrcLink.TIPropertyName);
+ SetObjectAndProperty(SrcLink.TIObject,SrcLink.TIPropertyName,
+ SrcLink.TIElementName);
end else begin
inherited Assign(Source);
end;
@@ -1468,6 +1500,12 @@ end;
procedure TCustomPropertyLink.SetObjectAndProperty(NewPersistent: TPersistent;
const NewPropertyName: string);
+begin
+ SetObjectAndProperty(NewPersistent,NewPropertyName,'');
+end;
+
+procedure TCustomPropertyLink.SetObjectAndProperty(NewPersistent: TPersistent;
+ const NewPropertyName, NewElementName: string);
var
AComponent: TComponent;
begin
@@ -1475,20 +1513,26 @@ begin
and ((length(NewPropertyName)>254) or (not IsValidIdent(NewPropertyName)))
then
raise Exception('TCustomPropertyLink.SetObjectAndProperty invalid identifier "'+NewPropertyName+'"');
- if (NewPersistent=TIObject) and (NewPropertyName=TIPropertyName) then exit;
- if (FTIObject is TComponent) then begin
- AComponent:=TComponent(FTIObject);
- AComponent.RemoveFreeNotification(FLinkNotifier);
+ if (NewPersistent<>TIObject) or (NewPropertyName<>TIPropertyName) then begin
+ if (FTIObject is TComponent) then begin
+ AComponent:=TComponent(FTIObject);
+ AComponent.RemoveFreeNotification(FLinkNotifier);
+ end;
+ FTIObject:=NewPersistent;
+ if FTIObject is TComponent then begin
+ AComponent:=TComponent(FTIObject);
+ if not (csDestroying in AComponent.ComponentState) then
+ AComponent.FreeNotification(FLinkNotifier)
+ else
+ FTIObject:=nil;
+ end;
+ FTIPropertyName:=NewPropertyName;
+ end
+ else if FTIElementName=NewElementName then begin
+ // no change
+ exit;
end;
- FTIObject:=NewPersistent;
- if FTIObject is TComponent then begin
- AComponent:=TComponent(FTIObject);
- if not (csDestroying in AComponent.ComponentState) then
- AComponent.FreeNotification(FLinkNotifier)
- else
- FTIObject:=nil;
- end;
- FTIPropertyName:=NewPropertyName;
+ FTIElementName:=NewElementName;
InvalidateEditor;
LoadFromProperty;
end;
@@ -1515,6 +1559,8 @@ begin
raise Exception.Create('Unable to create property editor for '
+FTIObject.ClassName+':'+FTIPropertyName);
end;}
+ if FTIElementName<>'' then
+
if CollectValues then FetchValues;
if ((FEditor<>nil) or OldEditorExisted) and Assigned(OnEditorChanged) then
OnEditorChanged(Self);
@@ -1569,7 +1615,7 @@ procedure TCustomPropertyLink.Notification(AComponent: TComponent;
begin
if (Operation=opRemove) then begin
if (AComponent=FTIObject) then
- SetObjectAndProperty(nil,FTIPropertyName);
+ SetObjectAndProperty(nil,FTIPropertyName,TIElementName);
end;
end;
@@ -1608,7 +1654,10 @@ end;
procedure TCustomPropertyLink.SetAsText(const NewText: string);
begin
try
- FEditor.SetValue(AliasValues.AliasToValue(NewText));
+ if (FTIElementName='') then
+ FEditor.SetValue(AliasValues.AliasToValue(NewText))
+ else
+ SetSetElementValue(FTIElementName,CompareText(NewText,'True')=0);
except
on E: Exception do DoError(true,E);
end;
@@ -1618,7 +1667,14 @@ function TCustomPropertyLink.GetAsText: string;
begin
Result:='';
try
- Result:=AliasValues.ValueToAlias(FEditor.GetVisualValue);
+ if (FTIElementName='') then
+ Result:=AliasValues.ValueToAlias(FEditor.GetVisualValue)
+ else begin
+ if GetSetElementValue(FTIElementName) then
+ Result:='True'
+ else
+ Result:='False';
+ end;
except
on E: Exception do DoError(false,E);
end;
@@ -2194,7 +2250,8 @@ procedure TTICustomCheckBox.LinkEditorChanged(Sender: TObject);
begin
if Sender=nil then ;
if (FLink<>nil) and (FLink.Editor<>nil) then begin
- if FLink.Editor is TBoolPropertyEditor then begin
+ if (FLink.Editor is TBoolPropertyEditor)
+ or (FLink.Editor is TSetPropertyEditor) then begin
FLinkValueFalse:='False';
FLinkValueTrue:='True';
end else if FLink.Editor is TOrdinalPropertyEditor then begin
@@ -2207,31 +2264,6 @@ begin
end;
end;
-procedure TTICustomCheckBox.DoAutoSize;
-var
- R : TRect;
- DC : hDC;
-begin
- If AutoSizing or not AutoSize then
- Exit;
- if (not HandleAllocated) or ([csLoading,csDestroying]*ComponentState<>[]) then
- exit;
- AutoSizing := True;
- DC := GetDC(Handle);
- Try
- R := Rect(0,0, Width, Height);
- DrawText(DC, PChar(Caption), Length(Caption), R,
- DT_CalcRect);
- If R.Right > Width then
- Width := R.Right + 25;
- If R.Bottom > Height then
- Height := R.Bottom + 2;
- Finally
- ReleaseDC(0, DC);
- AutoSizing := False;
- end;
-end;
-
procedure TTICustomCheckBox.SetLink(const AValue: TPropertyLink);
begin
if FLink=AValue then exit;
@@ -2262,7 +2294,7 @@ begin
FLinkValueTrue:='True';
FLink:=TPropertyLink.Create(Self);
FLink.Filter:=[{tkUnknown,}tkInteger{,tkChar},tkEnumeration,
- {tkFloat,tkSet,tkMethod,}tkSString,tkLString,tkAString,
+ {tkFloat,}tkSet,{tkMethod,}tkSString,tkLString,tkAString,
tkWString,tkVariant,{tkArray,tkRecord,tkInterface,}
{tkClass,tkObject,}tkWChar,tkBool,tkInt64,
tkQWord{,tkDynArray,tkInterfaceRaw}];
@@ -3399,17 +3431,133 @@ begin
SetLinks;
end;
+{ TTIElementNamePropertyEditor }
+
+procedure TTIElementNamePropertyEditor.GetCompatiblePropEdits(
+ Prop: TPropertyEditor);
+begin
+ if FPropEdits=nil then FPropEdits:=TList.Create;
+ FPropEdits.Add(Prop);
+end;
+
+procedure TTIElementNamePropertyEditor.GetElementPropEdits(Prop: TPropertyEditor
+ );
+begin
+ if FElementPropEdits=nil then FElementPropEdits:=TList.Create;
+ FElementPropEdits.Add(Prop);
+end;
+
+function TTIElementNamePropertyEditor.TestEditor(const Prop: TPropertyEditor
+ ): boolean;
+var
+ i: Integer;
+ CurPersistent: TPersistent;
+ ALink: TCustomPropertyLink;
+begin
+ Result:=false;
+ for i:=0 to PropCount-1 do begin
+ CurPersistent:=GetComponent(i);
+ if (CurPersistent is TCustomPropertyLink) then begin
+ ALink:=TCustomPropertyLink(CurPersistent);
+ //debugln('TTIElementNamePropertyEditor.TestEditor ',ALink.TIPropertyName,' ',Prop.GetName);
+ if (CompareText(ALink.TIPropertyName,Prop.GetName)<>0) then exit;
+ if Assigned(ALink.OnTestEditor) and (not ALink.OnTestEditor(Prop)) then
+ exit;
+ //debugln('TTIElementNamePropertyEditor.TestEditor ok ',ALink.TIPropertyName);
+ end;
+ end;
+ Result:=true;
+end;
+
+function TTIElementNamePropertyEditor.GetAttributes: TPropertyAttributes;
+begin
+ Result:=[paMultiSelect,paValueList,paSortList,paRevertable,paHasDefaultValue];
+end;
+
+function TTIElementNamePropertyEditor.GetEditLimit: Integer;
+begin
+ Result:=255;
+end;
+
+procedure TTIElementNamePropertyEditor.GetValues(Proc: TGetStringProc);
+var
+ ALink: TCustomPropertyLink;
+ ASelection: TPersistentSelectionList;
+ i: Integer;
+ CurPersistent: TPersistent;
+ CurTIObject: TPersistent;
+ Filter: TTypeKinds;
+ CurPropEdit: TPropertyEditor;
+ j: Integer;
+begin
+ ASelection:=TPersistentSelectionList.Create;
+ try
+ // get every TIObject of every TCustomPropertyLink in the selection
+ Filter:=AllTypeKinds;
+ for i:=0 to PropCount-1 do begin
+ CurPersistent:=GetComponent(i);
+ if (CurPersistent is TCustomPropertyLink) then begin
+ ALink:=TCustomPropertyLink(CurPersistent);
+ CurTIObject:=ALink.TIObject;
+ if CurTIObject<>nil then begin
+ ASelection.Add(CurTIObject);
+ Filter:=Filter*ALink.Filter;
+ end;
+ end;
+ end;
+ if ASelection.Count=0 then exit;
+ // get properties of all TIObjects
+ GetPersistentProperties(ASelection,Filter,PropertyHook,
+ @GetCompatiblePropEdits,nil,@TestEditor);
+ if FPropEdits<>nil then begin
+ // get the possible element values:
+ for i:=0 to FPropEdits.Count-1 do begin
+ CurPropEdit:=TPropertyEditor(FPropEdits[i]);
+ if paValueList in CurPropEdit.GetAttributes then
+ begin
+ // get value list
+ CurPropEdit.GetValues(Proc);
+ break;
+ end else if paSubProperties in CurPropEdit.GetAttributes then begin
+ // get names of sub property editors
+ CurPropEdit.GetProperties(@GetElementPropEdits);
+ if FElementPropEdits<>nil then begin
+ for j:=0 to FElementPropEdits.Count-1 do
+ Proc(TPropertyEditor(FElementPropEdits[j]).GetName);
+ break;
+ end;
+ end;
+ end;
+ end;
+ finally
+ ASelection.Free;
+ if FPropEdits<>nil then begin
+ for i:=0 to FPropEdits.Count-1 do
+ TPropertyEditor(FPropEdits[i]).Free;
+ FreeThenNil(FPropEdits);
+ end;
+ if FElementPropEdits<>nil then begin
+ for i:=0 to FElementPropEdits.Count-1 do
+ TPropertyEditor(FElementPropEdits[i]).Free;
+ FreeThenNil(FElementPropEdits);
+ end;
+ end;
+end;
+
initialization
{$I rttictrls.lrs}
// TPropertyLink
RegisterPropertyEditor(ClassTypeInfo(TPropertyLink),
nil, '', TPropertyLinkPropertyEditor);
- // property editor for TCustomPropertyLink.TIPropertyName
- RegisterPropertyEditor(TypeInfo(string),
- TCustomPropertyLink, 'TIPropertyName', TPropertyNamePropertyEditor);
// property editor for TCustomPropertyLink.TIObject
RegisterPropertyEditor(ClassTypeInfo(TPersistent),
TCustomPropertyLink, 'TIObject', TTIObjectPropertyEditor);
+ // property editor for TCustomPropertyLink.TIPropertyName
+ RegisterPropertyEditor(TypeInfo(string),
+ TCustomPropertyLink, 'TIPropertyName', TPropertyNamePropertyEditor);
+ // property editor for TCustomPropertyLink.TIElementName
+ RegisterPropertyEditor(TypeInfo(string),
+ TCustomPropertyLink, 'TIElementName', TTIElementNamePropertyEditor);
// property editor for TCustomPropertyLink.AliasValues
RegisterPropertyEditor(ClassTypeInfo(TAliasStrings),
TCustomPropertyLink, 'AliasValues', TPropLinkAliasPropertyEditor);
diff --git a/lcl/graphics.pp b/lcl/graphics.pp
index ca2b66486d..2f0414ea73 100644
--- a/lcl/graphics.pp
+++ b/lcl/graphics.pp
@@ -115,16 +115,59 @@ type
SystemFont: Boolean; // Use the system font instead of Canvas Font
end;
+ {$IFDEF UseFPCanvas}
+type
+ TPenStyle = TFPPenStyle;
+ TPenMode = TFPPenMode;
+ TBrushStyle = TFPBrushStyle;
+
+const
+ psSolid = FPCanvas.psSolid;
+ psDash = FPCanvas.psDash;
+ psDot = FPCanvas.psDot;
+ psDashDot = FPCanvas.psDashDot;
+ psDashDotDot = FPCanvas.psDashDotDot;
+ psClear = FPCanvas.psClear;
+ //psInsideframe = FPCanvas.psInsideframe;
+
+ pmBlack = FPCanvas.pmBlack;
+ pmWhite = FPCanvas.pmWhite;
+ pmNop = FPCanvas.pmNop;
+ pmNot = FPCanvas.pmNot;
+ pmCopy = FPCanvas.pmCopy;
+ pmNotCopy = FPCanvas.pmNotCopy;
+ pmMergePenNot = FPCanvas.pmMergePenNot;
+ pmMaskPenNot = FPCanvas.pmMaskPenNot;
+ pmMergeNotPen = FPCanvas.pmMergeNotPen;
+ pmMaskNotPen = FPCanvas.pmMaskNotPen;
+ pmMerge = FPCanvas.pmMerge;
+ pmNotMerge = FPCanvas.pmNotMerge;
+ pmMask = FPCanvas.pmMask;
+ pmNotMask = FPCanvas.pmNotMask;
+ pmXor = FPCanvas.pmXor;
+ pmNotXor = FPCanvas.pmNotXor;
+
+ bsSolid = FPCanvas.bsSolid;
+ bsClear = FPCanvas.bsClear;
+ bsHorizontal = FPCanvas.bsHorizontal;
+ bsVertical = FPCanvas.bsVertical;
+ bsFDiagonal = FPCanvas.bsFDiagonal;
+ bsBDiagonal = FPCanvas.bsBDiagonal;
+ bsCross = FPCanvas.bsCross;
+ bsDiagCross = FPCanvas.bsDiagCross;
+ {$ELSE}
+type
TPenStyle = (psSolid, psDash, psDot, psDashDot, psDashDotDot, psClear,
psInsideframe);
TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy, pmMergePenNot,
pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,pmNotMerge,
pmMask, pmNotMask, pmXor, pmNotXor
);
-
TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal,
bsBDiagonal, bsCross, bsDiagCross);
+ {$ENDIF}
+type
TFillStyle = TGraphicsFillStyle;
TFillMode = (fmAlternate, fmWinding);
@@ -524,10 +567,13 @@ type
private
FHandle: HPen;
FColor: TColor;
+ FPenHandleCached: boolean;
+ {$IFDEF UseFPCanvas}
+ {$ELSE}
FWidth: Integer;
FStyle: TPenStyle;
FMode: TPenMode;
- FPenHandleCached: boolean;
+ {$ENDIF}
procedure FreeHandle;
protected
{$IFDEF UseFPCanvas}
@@ -538,9 +584,9 @@ type
function GetHandle: HPEN;
procedure SetHandle(const Value: HPEN);
procedure SetColor(Value: TColor);
- procedure SetMode(Value: TPenMode);
- procedure SetStyle(Value: TPenStyle);
- procedure SetWidth(value: Integer);
+ procedure SetMode(Value: TPenMode); {$IFDEF UseFPCanvas}override;{$ENDIF}
+ procedure SetStyle(Value: TPenStyle); {$IFDEF UseFPCanvas}override;{$ENDIF}
+ procedure SetWidth(value: Integer); {$IFDEF UseFPCanvas}override;{$ENDIF}
public
constructor Create; {$IFDEF UseFPCanvas}override;{$ENDIF}
destructor Destroy; override;
@@ -1827,6 +1873,9 @@ end.
{ =============================================================================
$Log$
+ Revision 1.164 2004/12/23 22:38:18 mattias
+ implemented TIElementName of link of RTTI controls for set elements
+
Revision 1.163 2004/12/22 23:54:21 mattias
started TControl.AnchorSide
diff --git a/lcl/include/hintwindow.inc b/lcl/include/hintwindow.inc
index 7024664e15..d12e6caecd 100644
--- a/lcl/include/hintwindow.inc
+++ b/lcl/include/hintwindow.inc
@@ -79,7 +79,6 @@ var
begin
Rect := ClientRect;
Canvas.Brush.Color := Color;
- Canvas.Brush.Style := bsSolid;
Canvas.Pen.Width := 1;
DrawEdge(Canvas.Handle, Rect, BDR_RAISEDOUTER, BF_RECT);
with TS do
diff --git a/lcl/include/pen.inc b/lcl/include/pen.inc
index 8f600519b4..3a2a00a14b 100644
--- a/lcl/include/pen.inc
+++ b/lcl/include/pen.inc
@@ -60,10 +60,14 @@ end;
------------------------------------------------------------------------------}
Procedure TPen.SetStyle(Value : TPenStyle);
begin
- if FStyle <> Value
+ if Style <> Value
then begin
FreeHandle;
- FStyle := Value;
+ {$IFDEF UseFPCanvas}
+ inherited Style := Value;
+ {$ELSE}
+ FStyle:=Value;
+ {$ENDIF}
Changed;
end;
end;
@@ -77,9 +81,14 @@ end;
------------------------------------------------------------------------------}
Procedure TPen.SetMode(Value : TPenMode);
begin
- if FMode <> Value
+ if Mode <> Value
then begin
- FMode := Value;
+ FreeHandle;
+ {$IFDEF UseFPCanvas}
+ inherited Mode := Value;
+ {$ELSE}
+ FMode:=Value;
+ {$ENDIF}
Changed;
end;
end;
@@ -96,7 +105,11 @@ begin
if Width <> Value
then begin
FreeHandle;
- FWidth := Value;
+ {$IFDEF UseFPCanvas}
+ inherited Width := Value;
+ {$ELSE}
+ FWidth:=Value;
+ {$ENDIF}
Changed;
end;
end;
@@ -111,11 +124,17 @@ end;
constructor TPen.Create;
begin
inherited Create;
- FWidth := 1;
FHandle := 0;
+ {$IFDEF UseFPCanvas}
+ inherited Width := 1;
+ inherited Style := psSolid;
+ inherited Mode := pmCopy;
+ {$ELSE}
+ FWidth := 1;
FStyle := psSolid;
- FColor := clBlack;
FMode := pmCopy;
+ {$ENDIF}
+ Color := clBlack;
end;
{------------------------------------------------------------------------------
@@ -188,8 +207,8 @@ begin
FillChar(LogPen,SizeOf(LogPen),0);
with LogPen do
begin
- lopnStyle := PEN_STYLES[FStyle];
- lopnWidth.X := FWidth;
+ lopnStyle := PEN_STYLES[Style];
+ lopnWidth.X := Width;
lopnColor := FColor;
end;
CachedPen:=PenResourceCache.FindDescriptor(@LogPen);
@@ -256,6 +275,9 @@ end;
{ =============================================================================
$Log$
+ Revision 1.16 2004/12/23 22:38:18 mattias
+ implemented TIElementName of link of RTTI controls for set elements
+
Revision 1.15 2004/12/22 23:54:21 mattias
started TControl.AnchorSide
diff --git a/lcl/pairsplitter.pas b/lcl/pairsplitter.pas
index ca9373db7e..0096a09856 100644
--- a/lcl/pairsplitter.pas
+++ b/lcl/pairsplitter.pas
@@ -35,8 +35,8 @@ unit PairSplitter;
interface
uses
- Classes, SysUtils, LCLType, LCLProc, LMessages, Graphics, GraphType, LCLIntf,
- Controls;
+ Classes, SysUtils,
+ LCLType, LCLProc, LMessages, Graphics, GraphType, LCLIntf, Controls;
type
TCustomPairSplitter = class;
diff --git a/lcl/postscriptcanvas.pas b/lcl/postscriptcanvas.pas
index e3716a8f42..bd751126d6 100644
--- a/lcl/postscriptcanvas.pas
+++ b/lcl/postscriptcanvas.pas
@@ -176,9 +176,16 @@ Type
end;
Const
- cBrushStyle : Array[bsSolid..bsDiagCross] of String = ('bsSolid','bsClear','bsHorizontal',
- 'bsVertical','bsFDiagonal',
- 'bsBDiagonal','bsCross','bsDiagCross');
+ cBrushStyle : Array[TBrushStyle] of String =
+ {$IFDEF UseFPCanvas}
+ ('bsClear', 'bsSolid', 'bsBDiagonal',
+ 'bsFDiagonal', 'bsCross', 'bsDiagCross',
+ 'bsHorizontal', 'bsVertical', 'bsImage', 'bsPattern');
+ {$ELSE}
+ ('bsSolid','bsClear','bsHorizontal',
+ 'bsVertical','bsFDiagonal',
+ 'bsBDiagonal','bsCross','bsDiagCross');
+ {$ENDIF}
cFontPSMetrics : Array[0..12] of TFontPSMetrics =(