implemented TIElementName of link of RTTI controls for set elements

git-svn-id: trunk@6416 -
This commit is contained in:
mattias 2004-12-23 22:38:18 +00:00
parent 45f82e0f1e
commit 1c996f9973
13 changed files with 485 additions and 187 deletions

View File

@ -1,15 +1,15 @@
object Form1: TForm1 object Form1: TForm1
ActiveControl = TIEdit1 ActiveControl = TIEdit1
Caption = 'RTTI Controls Example' Caption = 'RTTI Controls Example'
ClientHeight = 357 ClientHeight = 392
ClientWidth = 590 ClientWidth = 619
PixelsPerInch = 90 PixelsPerInch = 90
HorzScrollBar.Page = 591 HorzScrollBar.Page = 620
VertScrollBar.Page = 358 VertScrollBar.Page = 393
Left = 291 Left = 294
Height = 357 Height = 392
Top = 163 Top = 168
Width = 590 Width = 619
object TIEdit1: TTIEdit object TIEdit1: TTIEdit
Link.TIObject = TICheckBox1 Link.TIObject = TICheckBox1
Link.TIPropertyName = 'Caption' Link.TIPropertyName = 'Caption'
@ -30,9 +30,9 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
TabStop = True TabStop = True
Left = 176 Left = 176
Height = 20 Height = 24
Top = 136 Top = 136
Width = 109 Width = 98
end end
object TIListBox_Color: TTIListBox object TIListBox_Color: TTIListBox
BorderStyle = bsSingle BorderStyle = bsSingle
@ -41,6 +41,7 @@ object Form1: TForm1
Link.TIPropertyName = 'Color' Link.TIPropertyName = 'Color'
TabOrder = 2 TabOrder = 2
TabStop = True TabStop = True
TopIndex = -1
Left = 11 Left = 11
Height = 70 Height = 70
Top = 200 Top = 200
@ -103,9 +104,9 @@ object Form1: TForm1
Tabstop = True Tabstop = True
TIObject = StaticText4 TIObject = StaticText4
ValueFont.Color = clMaroon ValueFont.Color = clMaroon
Left = 312 Left = 328
Height = 225 Height = 225
Top = 119 Top = 144
Width = 242 Width = 242
end end
object Label1: TLabel object Label1: TLabel
@ -116,4 +117,18 @@ object Form1: TForm1
Top = 9 Top = 9
Width = 286 Width = 286
end 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 end

View File

@ -2,37 +2,42 @@
LazarusResources.Add('TForm1','FORMDATA',[ LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#13'ActiveControl'#7#7'TIEdit1'#7'Caption'#6#21'RTTI' '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' +' Controls Example'#12'ClientHeight'#3#136#1#11'ClientWidth'#3'k'#2#13'Pixel'
+'PerInch'#2'Z'#18'HorzScrollBar.Page'#3'O'#2#18'VertScrollBar.Page'#3'f'#1#4 +'sPerInch'#2'Z'#18'HorzScrollBar.Page'#3'l'#2#18'VertScrollBar.Page'#3#137#1
+'Left'#3'#'#1#6'Height'#3'e'#1#3'Top'#3#163#0#5'Width'#3'N'#2#0#7'TTIEdit'#7 +#4'Left'#3'&'#1#6'Height'#3#136#1#3'Top'#3#168#0#5'Width'#3'k'#2#0#7'TTIEdit'
+'TIEdit1'#13'Link.TIObject'#7#11'TICheckBox1'#19'Link.TIPropertyName'#6#7'Ca' +#7'TIEdit1'#13'Link.TIObject'#7#11'TICheckBox1'#19'Link.TIPropertyName'#6#7
+'ption'#7'TabStop'#9#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2#23#3'Top'#3#136 +'Caption'#7'TabStop'#9#8'TabOrder'#2#0#4'Left'#2#8#6'Height'#2#23#3'Top'#3
+#0#5'Width'#3#144#0#0#0#11'TTICheckBox'#11'TICheckBox1'#11'AllowGrayed'#9#8 +#136#0#5'Width'#3#144#0#0#0#11'TTICheckBox'#11'TICheckBox1'#11'AllowGrayed'#9
+'AutoSize'#9#7'Caption'#6#11'TICheckBox1'#13'Link.TIObject'#7#7'TIEdit1'#19 +#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 +'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' +#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 +'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 +'Color'#8'TabOrder'#2#2#7'TabStop'#9#8'TopIndex'#2#255#4'Left'#2#11#6'Height'
+#0#5'Width'#2'u'#0#0#11'TStaticText'#11'StaticText1'#7'Caption'#6'!Edit capt' +#2'F'#3'Top'#3#200#0#5'Width'#2'u'#0#0#11'TStaticText'#11'StaticText1'#7'Cap'
+'ion of right TTICheckbox'#5'Color'#7#7'clOlive'#8'TabOrder'#2#3#7'TabStop'#9 +'tion'#6'!Edit caption of right TTICheckbox'#5'Color'#7#7'clOlive'#8'TabOrde'
+#4'Left'#2#8#6'Height'#2#17#3'Top'#2'p'#5'Width'#3#193#0#0#0#11'TStaticText' +'r'#2#3#7'TabStop'#9#4'Left'#2#8#6'Height'#2#17#3'Top'#2'p'#5'Width'#3#193#0
+#11'StaticText2'#7'Caption'#6#31'Edit Color of above TStaticText'#11'ParentC' +#0#0#11'TStaticText'#11'StaticText2'#7'Caption'#6#31'Edit Color of above TSt'
+'olor'#9#8'TabOrder'#2#4#7'TabStop'#9#4'Left'#2#11#6'Height'#2#17#3'Top'#3 +'aticText'#11'ParentColor'#9#8'TabOrder'#2#4#7'TabStop'#9#4'Left'#2#11#6'Hei'
+#176#0#5'Width'#3#194#0#0#0#11'TTIComboBox'#18'TIComboBox_Enabled'#13'Link.T' +'ght'#2#17#3'Top'#3#176#0#5'Width'#3#194#0#0#0#11'TTIComboBox'#18'TIComboBox'
+'IObject'#7#11'TICheckBox1'#19'Link.TIPropertyName'#6#7'Enabled'#9'MaxLength' +'_Enabled'#13'Link.TIObject'#7#11'TICheckBox1'#19'Link.TIPropertyName'#6#7'E'
+#2#0#8'TabOrder'#2#5#7'TabStop'#9#4'Left'#2#16#6'Height'#2#25#3'Top'#3'2'#1#5 +'nabled'#9'MaxLength'#2#0#8'TabOrder'#2#5#7'TabStop'#9#4'Left'#2#16#6'Height'
+'Width'#3#180#0#0#0#11'TStaticText'#11'StaticText3'#7'Caption'#6#25'Edit TTI' +#2#25#3'Top'#3'2'#1#5'Width'#3#180#0#0#0#11'TStaticText'#11'StaticText3'#7'C'
+'CheckBox1.Enabled'#11'ParentColor'#9#8'TabOrder'#2#6#7'TabStop'#9#4'Left'#2 +'aption'#6#25'Edit TTICheckBox1.Enabled'#11'ParentColor'#9#8'TabOrder'#2#6#7
+#15#6'Height'#2#17#3'Top'#3#27#1#5'Width'#3#186#0#0#0#11'TStaticText'#11'Sta' +'TabStop'#9#4'Left'#2#15#6'Height'#2#17#3'Top'#3#27#1#5'Width'#3#186#0#0#0#11
+'ticText4'#7'Caption'#6'4Edit this TStaticText with the TTIPropertyGrid belo' +'TStaticText'#11'StaticText4'#7'Caption'#6'4Edit this TStaticText with the T'
+'w'#11'ParentColor'#9#8'TabOrder'#2#7#7'TabStop'#9#4'Left'#3'`'#1#6'Height'#2 +'TIPropertyGrid below'#11'ParentColor'#9#8'TabOrder'#2#7#7'TabStop'#9#4'Left'
+'P'#3'Top'#2#16#5'Width'#3#145#0#0#0#15'TTIPropertyGrid'#15'TIPropertyGrid1' +#3'`'#1#6'Height'#2'P'#3'Top'#2#16#5'Width'#3#145#0#0#0#15'TTIPropertyGrid'
+#11'BorderStyle'#7#8'bsSingle'#22'DefaultValueFont.Color'#7#15'clActiveCapti' +#15'TIPropertyGrid1'#11'BorderStyle'#7#8'bsSingle'#22'DefaultValueFont.Color'
+'on'#7'Tabstop'#9#8'TIObject'#7#11'StaticText4'#15'ValueFont.Color'#7#8'clMa' +#7#15'clActiveCaption'#7'Tabstop'#9#8'TIObject'#7#11'StaticText4'#15'ValueFo'
+'roon'#4'Left'#3'8'#1#6'Height'#3#225#0#3'Top'#2'w'#5'Width'#3#242#0#0#0#6'T' +'nt.Color'#7#8'clMaroon'#4'Left'#3'H'#1#6'Height'#3#225#0#3'Top'#3#144#0#5'W'
+'Label'#6'Label1'#7'Caption'#6#156'This is a demonstration of a few RTTI Con' +'idth'#3#242#0#0#0#6'TLabel'#6'Label1'#7'Caption'#6#156'This is a demonstrat'
+'trols.'#10'The RTTI controls allows you to edit properties of objects.'#10 +'ion of a few RTTI Controls.'#10'The RTTI controls allows you to edit proper'
+'The whole example requires not one line of code.'#8'WordWrap'#9#4'Left'#2#10 +'ties of objects.'#10'The whole example requires not one line of code.'#8'Wo'
+#6'Height'#2'W'#3'Top'#2#9#5'Width'#3#30#1#0#0#0 +'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
]); ]);

View File

@ -34,6 +34,7 @@ type
StaticText3: TStaticText; StaticText3: TStaticText;
StaticText4: TStaticText; StaticText4: TStaticText;
TICheckBox1: TTICheckBox; TICheckBox1: TTICheckBox;
TICheckBox2: TTICheckBox;
TIComboBox_Enabled: TTIComboBox; TIComboBox_Enabled: TTIComboBox;
TIEdit1: TTIEdit; TIEdit1: TTIEdit;
TIListBox_Color: TTIListBox; TIListBox_Color: TTIListBox;

View File

@ -1,26 +1,26 @@
object Form1: TForm1 object Form1: TForm1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 300 ClientHeight = 410
ClientWidth = 400 ClientWidth = 350
OnCreate = Form1Create OnCreate = Form1Create
OnDestroy = Form1Destroy OnDestroy = Form1Destroy
PixelsPerInch = 90 PixelsPerInch = 90
HorzScrollBar.Page = 401 HorzScrollBar.Page = 351
VertScrollBar.Page = 301 VertScrollBar.Page = 411
Left = 273 Left = 273
Height = 300 Height = 410
Top = 181 Top = 181
Width = 400 Width = 350
object GroupBox1: TGroupBox object GroupBox1: TGroupBox
Caption = 'MyString' Caption = 'MyString'
ClientHeight = 31 ClientHeight = 31
ClientWidth = 331 ClientWidth = 296
ParentColor = True ParentColor = True
TabOrder = 0 TabOrder = 0
Left = 24 Left = 24
Height = 48 Height = 48
Top = 16 Top = 16
Width = 335 Width = 300
object TIEdit1: TTIEdit object TIEdit1: TTIEdit
TabStop = True TabStop = True
TabOrder = 0 TabOrder = 0
@ -37,18 +37,18 @@ object Form1: TForm1
Left = 25 Left = 25
Height = 57 Height = 57
Top = 72 Top = 72
Width = 338 Width = 300
end end
object GroupBox2: TGroupBox object GroupBox2: TGroupBox
Caption = 'MyRange' Caption = 'MyRange'
ClientHeight = 24 ClientHeight = 24
ClientWidth = 335 ClientWidth = 296
ParentColor = True ParentColor = True
TabOrder = 2 TabOrder = 2
Left = 25 Left = 25
Height = 41 Height = 41
Top = 144 Top = 144
Width = 339 Width = 300
object TITrackBar1: TTITrackBar object TITrackBar1: TTITrackBar
ScalePos = trTop ScalePos = trTop
TabOrder = 0 TabOrder = 0
@ -66,6 +66,6 @@ object Form1: TForm1
Left = 27 Left = 27
Height = 87 Height = 87
Top = 199 Top = 199
Width = 338 Width = 300
end end
end end

View File

@ -1,21 +1,21 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[ LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3','#1#11'Cl' 'TPF0'#6'TForm1'#5'Form1'#7'Caption'#6#5'Form1'#12'ClientHeight'#3#154#1#11'C'
+'ientWidth'#3#144#1#8'OnCreate'#7#11'Form1Create'#9'OnDestroy'#7#12'Form1Des' +'lientWidth'#3'^'#1#8'OnCreate'#7#11'Form1Create'#9'OnDestroy'#7#12'Form1Des'
+'troy'#13'PixelsPerInch'#2'Z'#18'HorzScrollBar.Page'#3#145#1#18'VertScrollBa' +'troy'#13'PixelsPerInch'#2'Z'#18'HorzScrollBar.Page'#3'_'#1#18'VertScrollBar'
+'r.Page'#3'-'#1#4'Left'#3#17#1#6'Height'#3','#1#3'Top'#3#181#0#5'Width'#3#144 +'.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 +#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' +#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'O'#1#0#7'TTIEdit'#7'TIEdit1'#7'TabStop'#9#8 +'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 +'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 +#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' +'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 +'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'S'#1#0#11'TTITrackBar'#11'TITrackBar1'#8'Scale' +')'#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' +'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' +#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' +'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
]); ]);

View File

@ -9,53 +9,121 @@
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="exampleproject1"/> <Title Value="exampleproject1"/>
</General> </General>
<JumpHistory Count="11" HistoryIndex="10"> <JumpHistory Count="28" HistoryIndex="27">
<Position1> <Position1>
<Filename Value="example1.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="39" Column="25" TopLine="13"/> <Caret Line="174" Column="64" TopLine="162"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3130" Column="12" TopLine="3123"/> <Caret Line="124" Column="17" TopLine="102"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="1511" Column="11" TopLine="1508"/> <Caret Line="3036" Column="14" TopLine="3020"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3129" Column="1" TopLine="3102"/> <Caret Line="2197" Column="1" TopLine="2194"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3130" Column="3" TopLine="3107"/> <Caret Line="668" Column="29" TopLine="661"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="603" Column="15" TopLine="581"/> <Caret Line="2213" Column="15" TopLine="2194"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="174" Column="64" TopLine="162"/> <Caret Line="2307" Column="21" TopLine="2289"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="124" Column="17" TopLine="102"/> <Caret Line="736" Column="11" TopLine="709"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3036" Column="14" TopLine="3020"/> <Caret Line="1" Column="1" TopLine="1"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="2197" Column="1" TopLine="2194"/> <Caret Line="329" Column="20" TopLine="307"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="668" Column="29" TopLine="661"/> <Caret Line="385" Column="20" TopLine="363"/>
</Position11> </Position11>
<Position12>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="755" Column="20" TopLine="733"/>
</Position12>
<Position13>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="861" Column="20" TopLine="839"/>
</Position13>
<Position14>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="1065" Column="20" TopLine="1043"/>
</Position14>
<Position15>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position15>
<Position16>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="732" Column="13" TopLine="713"/>
</Position16>
<Position17>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3501" Column="1" TopLine="3471"/>
</Position17>
<Position18>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3502" Column="1" TopLine="3468"/>
</Position18>
<Position19>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3496" Column="14" TopLine="3466"/>
</Position19>
<Position20>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3511" Column="26" TopLine="3481"/>
</Position20>
<Position21>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3480" Column="32" TopLine="3471"/>
</Position21>
<Position22>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3502" Column="11" TopLine="3481"/>
</Position22>
<Position23>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/ideintf/propedits.pp"/>
<Caret Line="3070" Column="65" TopLine="3064"/>
</Position23>
<Position24>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3446" Column="5" TopLine="3397"/>
</Position24>
<Position25>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3490" Column="14" TopLine="3489"/>
</Position25>
<Position26>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3528" Column="17" TopLine="3497"/>
</Position26>
<Position27>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="3533" Column="1" TopLine="3511"/>
</Position27>
<Position28>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Caret Line="1676" Column="1" TopLine="1664"/>
</Position28>
</JumpHistory> </JumpHistory>
<Units Count="6"> <Units Count="7">
<Unit0> <Unit0>
<CursorPos X="10" Y="9"/> <CursorPos X="10" Y="9"/>
<Filename Value="exampleproject1.lpr"/> <Filename Value="exampleproject1.lpr"/>
@ -65,23 +133,23 @@
<UsageCount Value="30"/> <UsageCount Value="30"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<CursorPos X="25" Y="39"/> <CursorPos X="14" Y="40"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<Filename Value="example1.pas"/> <Filename Value="example1.pas"/>
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<ResourceFilename Value="example1.lrs"/> <ResourceFilename Value="example1.lrs"/>
<TopLine Value="13"/> <TopLine Value="10"/>
<UnitName Value="Example1"/> <UnitName Value="Example1"/>
<UsageCount Value="30"/> <UsageCount Value="30"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<CursorPos X="1" Y="2197"/> <CursorPos X="1" Y="39"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/> <Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<TopLine Value="2194"/> <TopLine Value="1"/>
<UnitName Value="RTTICtrls"/> <UnitName Value="RTTICtrls"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit2> </Unit2>
@ -104,6 +172,15 @@
<TopLine Value="32"/> <TopLine Value="32"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit5> </Unit5>
<Unit6>
<CursorPos X="54" Y="270"/>
<EditorIndex Value="2"/>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/ideintf/propedits.pp"/>
<Loaded Value="True"/>
<TopLine Value="248"/>
<UnitName Value="PropEdits"/>
<UsageCount Value="10"/>
</Unit6>
</Units> </Units>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>

View File

@ -3,27 +3,25 @@
<ProjectOptions> <ProjectOptions>
<Version Value="5"/> <Version Value="5"/>
<General> <General>
<Flags>
<SaveClosedFiles Value="False"/>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<ActiveEditorIndexAtStart Value="1"/> <ActiveEditorIndexAtStart Value="1"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="exampleproject2"/> <Title Value="exampleproject2"/>
</General> </General>
<JumpHistory Count="1" HistoryIndex="0"> <Units Count="2">
<Position1>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/helpmanager.pas"/>
<Caret Line="120" Column="15" TopLine="106"/>
</Position1>
</JumpHistory>
<Units Count="5">
<Unit0> <Unit0>
<Filename Value="exampleproject2.lpr"/> <Filename Value="exampleproject2.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="ExampleProject2"/> <UnitName Value="ExampleProject2"/>
<UsageCount Value="30"/> <UsageCount Value="31"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<CursorPos X="23" Y="46"/> <CursorPos X="12" Y="28"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<Filename Value="example2.pas"/> <Filename Value="example2.pas"/>
<ComponentName Value="Form1"/> <ComponentName Value="Form1"/>
@ -32,31 +30,8 @@
<ResourceFilename Value="example2.lrs"/> <ResourceFilename Value="example2.lrs"/>
<TopLine Value="22"/> <TopLine Value="22"/>
<UnitName Value="Example2"/> <UnitName Value="Example2"/>
<UsageCount Value="30"/> <UsageCount Value="31"/>
</Unit1> </Unit1>
<Unit2>
<CursorPos X="28" Y="47"/>
<EditorIndex Value="1"/>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/helpmanager.pas"/>
<Loaded Value="True"/>
<TopLine Value="29"/>
<UnitName Value="HelpManager"/>
<UsageCount Value="15"/>
</Unit2>
<Unit3>
<CursorPos X="20" Y="1803"/>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/lcl/controls.pp"/>
<TopLine Value="1779"/>
<UnitName Value="Controls"/>
<UsageCount Value="9"/>
</Unit3>
<Unit4>
<CursorPos X="13" Y="144"/>
<Filename Value="/home/mattias/pascal/wichtig/lazarus/components/rtticontrols/rttictrls.pas"/>
<TopLine Value="125"/>
<UnitName Value="RTTICtrls"/>
<UsageCount Value="10"/>
</Unit4>
</Units> </Units>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>

View File

@ -22,6 +22,8 @@
ToDo: ToDo:
- ploReadOnly - ploReadOnly
- TTICheckBox with Enums (e.g. TTICheckBox.Checked = Enum property has the
same value as TIElementName)
} }
unit RTTICtrls; unit RTTICtrls;
@ -100,12 +102,14 @@ Type
FOptions: TPropertyLinkOptions; FOptions: TPropertyLinkOptions;
FOwner: TComponent; FOwner: TComponent;
FSaveEnabled: boolean; FSaveEnabled: boolean;
FTIElementName: string;
FTIObject: TPersistent; FTIObject: TPersistent;
FTIPropertyName: string; FTIPropertyName: string;
procedure SetCollectValues(const AValue: boolean); procedure SetCollectValues(const AValue: boolean);
procedure SetEditor(const AValue: TPropertyEditor); procedure SetEditor(const AValue: TPropertyEditor);
procedure SetFilter(const AValue: TTypeKinds); procedure SetFilter(const AValue: TTypeKinds);
procedure SetOptions(const NewOptions: TPropertyLinkOptions); procedure SetOptions(const NewOptions: TPropertyLinkOptions);
procedure SetTIElementName(const AValue: string);
procedure SetTIObject(const AValue: TPersistent); procedure SetTIObject(const AValue: TPersistent);
procedure SetTIPropertyName(const AValue: string); procedure SetTIPropertyName(const AValue: string);
protected protected
@ -126,6 +130,8 @@ Type
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
procedure SetObjectAndProperty(NewPersistent: TPersistent; procedure SetObjectAndProperty(NewPersistent: TPersistent;
const NewPropertyName: string); const NewPropertyName: string);
procedure SetObjectAndProperty(NewPersistent: TPersistent;
const NewPropertyName, NewElementName: string);
procedure InvalidateEditor; virtual; procedure InvalidateEditor; virtual;
procedure CreateEditor; virtual; procedure CreateEditor; virtual;
procedure FetchValues; virtual; procedure FetchValues; virtual;
@ -176,6 +182,7 @@ Type
property SaveEnabled: boolean read FSaveEnabled write FSaveEnabled; property SaveEnabled: boolean read FSaveEnabled write FSaveEnabled;
property TIObject: TPersistent read FTIObject write SetTIObject; property TIObject: TPersistent read FTIObject write SetTIObject;
property TIPropertyName: string read FTIPropertyName write SetTIPropertyName; property TIPropertyName: string read FTIPropertyName write SetTIPropertyName;
property TIElementName: string read FTIElementName write SetTIElementName;
end; end;
@ -187,6 +194,7 @@ Type
property Options; property Options;
property TIObject; property TIObject;
property TIPropertyName; property TIPropertyName;
property TIElementName;
end; end;
@ -198,6 +206,12 @@ Type
end; end;
{ TTIObjectPropertyEditor }
TTIObjectPropertyEditor = class(TPersistentPropertyEditor)
end;
{ TPropertyNamePropertyEditor { TPropertyNamePropertyEditor
Property editor for TCustomPropertyLink.TIPropertyName, showing Property editor for TCustomPropertyLink.TIPropertyName, showing
all compatible properties. } all compatible properties. }
@ -214,9 +228,21 @@ Type
end; 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; end;
@ -710,7 +736,6 @@ Type
procedure LinkLoadFromProperty(Sender: TObject); virtual; procedure LinkLoadFromProperty(Sender: TObject); virtual;
procedure LinkSaveToProperty(Sender: TObject); virtual; procedure LinkSaveToProperty(Sender: TObject); virtual;
procedure LinkEditorChanged(Sender: TObject); virtual; procedure LinkEditorChanged(Sender: TObject); virtual;
procedure DoAutoSize; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -1390,6 +1415,12 @@ begin
if (ploReadOnIdle in ChangedOptions) then UpdateIdleHandler; if (ploReadOnIdle in ChangedOptions) then UpdateIdleHandler;
end; end;
procedure TCustomPropertyLink.SetTIElementName(const AValue: string);
begin
if FTIElementName=AValue then exit;
SetObjectAndProperty(TIObject,TIPropertyName,AValue);
end;
function TCustomPropertyLink.GetCanModify: boolean; function TCustomPropertyLink.GetCanModify: boolean;
begin begin
Result:=(FEditor<>nil) and (not FEditor.IsReadOnly); Result:=(FEditor<>nil) and (not FEditor.IsReadOnly);
@ -1398,13 +1429,13 @@ end;
procedure TCustomPropertyLink.SetTIObject(const AValue: TPersistent); procedure TCustomPropertyLink.SetTIObject(const AValue: TPersistent);
begin begin
if FTIObject=AValue then exit; if FTIObject=AValue then exit;
SetObjectAndProperty(AValue,TIPropertyName); SetObjectAndProperty(AValue,TIPropertyName,TIElementName);
end; end;
procedure TCustomPropertyLink.SetTIPropertyName(const AValue: string); procedure TCustomPropertyLink.SetTIPropertyName(const AValue: string);
begin begin
if FTIPropertyName=AValue then exit; if FTIPropertyName=AValue then exit;
SetObjectAndProperty(TIObject,AValue); SetObjectAndProperty(TIObject,AValue,TIElementName);
end; end;
procedure TCustomPropertyLink.EditorChanged; procedure TCustomPropertyLink.EditorChanged;
@ -1460,7 +1491,8 @@ var
begin begin
if Source is TCustomPropertyLink then begin if Source is TCustomPropertyLink then begin
SrcLink:=TCustomPropertyLink(Source); SrcLink:=TCustomPropertyLink(Source);
SetObjectAndProperty(SrcLink.TIObject,SrcLink.TIPropertyName); SetObjectAndProperty(SrcLink.TIObject,SrcLink.TIPropertyName,
SrcLink.TIElementName);
end else begin end else begin
inherited Assign(Source); inherited Assign(Source);
end; end;
@ -1468,6 +1500,12 @@ end;
procedure TCustomPropertyLink.SetObjectAndProperty(NewPersistent: TPersistent; procedure TCustomPropertyLink.SetObjectAndProperty(NewPersistent: TPersistent;
const NewPropertyName: string); const NewPropertyName: string);
begin
SetObjectAndProperty(NewPersistent,NewPropertyName,'');
end;
procedure TCustomPropertyLink.SetObjectAndProperty(NewPersistent: TPersistent;
const NewPropertyName, NewElementName: string);
var var
AComponent: TComponent; AComponent: TComponent;
begin begin
@ -1475,20 +1513,26 @@ begin
and ((length(NewPropertyName)>254) or (not IsValidIdent(NewPropertyName))) and ((length(NewPropertyName)>254) or (not IsValidIdent(NewPropertyName)))
then then
raise Exception('TCustomPropertyLink.SetObjectAndProperty invalid identifier "'+NewPropertyName+'"'); raise Exception('TCustomPropertyLink.SetObjectAndProperty invalid identifier "'+NewPropertyName+'"');
if (NewPersistent=TIObject) and (NewPropertyName=TIPropertyName) then exit; if (NewPersistent<>TIObject) or (NewPropertyName<>TIPropertyName) then begin
if (FTIObject is TComponent) then begin if (FTIObject is TComponent) then begin
AComponent:=TComponent(FTIObject); AComponent:=TComponent(FTIObject);
AComponent.RemoveFreeNotification(FLinkNotifier); 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; end;
FTIObject:=NewPersistent; FTIElementName:=NewElementName;
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;
InvalidateEditor; InvalidateEditor;
LoadFromProperty; LoadFromProperty;
end; end;
@ -1515,6 +1559,8 @@ begin
raise Exception.Create('Unable to create property editor for ' raise Exception.Create('Unable to create property editor for '
+FTIObject.ClassName+':'+FTIPropertyName); +FTIObject.ClassName+':'+FTIPropertyName);
end;} end;}
if FTIElementName<>'' then
if CollectValues then FetchValues; if CollectValues then FetchValues;
if ((FEditor<>nil) or OldEditorExisted) and Assigned(OnEditorChanged) then if ((FEditor<>nil) or OldEditorExisted) and Assigned(OnEditorChanged) then
OnEditorChanged(Self); OnEditorChanged(Self);
@ -1569,7 +1615,7 @@ procedure TCustomPropertyLink.Notification(AComponent: TComponent;
begin begin
if (Operation=opRemove) then begin if (Operation=opRemove) then begin
if (AComponent=FTIObject) then if (AComponent=FTIObject) then
SetObjectAndProperty(nil,FTIPropertyName); SetObjectAndProperty(nil,FTIPropertyName,TIElementName);
end; end;
end; end;
@ -1608,7 +1654,10 @@ end;
procedure TCustomPropertyLink.SetAsText(const NewText: string); procedure TCustomPropertyLink.SetAsText(const NewText: string);
begin begin
try try
FEditor.SetValue(AliasValues.AliasToValue(NewText)); if (FTIElementName='') then
FEditor.SetValue(AliasValues.AliasToValue(NewText))
else
SetSetElementValue(FTIElementName,CompareText(NewText,'True')=0);
except except
on E: Exception do DoError(true,E); on E: Exception do DoError(true,E);
end; end;
@ -1618,7 +1667,14 @@ function TCustomPropertyLink.GetAsText: string;
begin begin
Result:=''; Result:='';
try 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 except
on E: Exception do DoError(false,E); on E: Exception do DoError(false,E);
end; end;
@ -2194,7 +2250,8 @@ procedure TTICustomCheckBox.LinkEditorChanged(Sender: TObject);
begin begin
if Sender=nil then ; if Sender=nil then ;
if (FLink<>nil) and (FLink.Editor<>nil) then begin 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'; FLinkValueFalse:='False';
FLinkValueTrue:='True'; FLinkValueTrue:='True';
end else if FLink.Editor is TOrdinalPropertyEditor then begin end else if FLink.Editor is TOrdinalPropertyEditor then begin
@ -2207,31 +2264,6 @@ begin
end; end;
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); procedure TTICustomCheckBox.SetLink(const AValue: TPropertyLink);
begin begin
if FLink=AValue then exit; if FLink=AValue then exit;
@ -2262,7 +2294,7 @@ begin
FLinkValueTrue:='True'; FLinkValueTrue:='True';
FLink:=TPropertyLink.Create(Self); FLink:=TPropertyLink.Create(Self);
FLink.Filter:=[{tkUnknown,}tkInteger{,tkChar},tkEnumeration, FLink.Filter:=[{tkUnknown,}tkInteger{,tkChar},tkEnumeration,
{tkFloat,tkSet,tkMethod,}tkSString,tkLString,tkAString, {tkFloat,}tkSet,{tkMethod,}tkSString,tkLString,tkAString,
tkWString,tkVariant,{tkArray,tkRecord,tkInterface,} tkWString,tkVariant,{tkArray,tkRecord,tkInterface,}
{tkClass,tkObject,}tkWChar,tkBool,tkInt64, {tkClass,tkObject,}tkWChar,tkBool,tkInt64,
tkQWord{,tkDynArray,tkInterfaceRaw}]; tkQWord{,tkDynArray,tkInterfaceRaw}];
@ -3399,17 +3431,133 @@ begin
SetLinks; SetLinks;
end; 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 initialization
{$I rttictrls.lrs} {$I rttictrls.lrs}
// TPropertyLink // TPropertyLink
RegisterPropertyEditor(ClassTypeInfo(TPropertyLink), RegisterPropertyEditor(ClassTypeInfo(TPropertyLink),
nil, '', TPropertyLinkPropertyEditor); nil, '', TPropertyLinkPropertyEditor);
// property editor for TCustomPropertyLink.TIPropertyName
RegisterPropertyEditor(TypeInfo(string),
TCustomPropertyLink, 'TIPropertyName', TPropertyNamePropertyEditor);
// property editor for TCustomPropertyLink.TIObject // property editor for TCustomPropertyLink.TIObject
RegisterPropertyEditor(ClassTypeInfo(TPersistent), RegisterPropertyEditor(ClassTypeInfo(TPersistent),
TCustomPropertyLink, 'TIObject', TTIObjectPropertyEditor); 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 // property editor for TCustomPropertyLink.AliasValues
RegisterPropertyEditor(ClassTypeInfo(TAliasStrings), RegisterPropertyEditor(ClassTypeInfo(TAliasStrings),
TCustomPropertyLink, 'AliasValues', TPropLinkAliasPropertyEditor); TCustomPropertyLink, 'AliasValues', TPropLinkAliasPropertyEditor);

View File

@ -115,16 +115,59 @@ type
SystemFont: Boolean; // Use the system font instead of Canvas Font SystemFont: Boolean; // Use the system font instead of Canvas Font
end; 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, TPenStyle = (psSolid, psDash, psDot, psDashDot, psDashDotDot, psClear,
psInsideframe); psInsideframe);
TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy, pmMergePenNot, TPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy, pmMergePenNot,
pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,pmNotMerge, pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,pmNotMerge,
pmMask, pmNotMask, pmXor, pmNotXor pmMask, pmNotMask, pmXor, pmNotXor
); );
TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal, TBrushStyle = (bsSolid, bsClear, bsHorizontal, bsVertical, bsFDiagonal,
bsBDiagonal, bsCross, bsDiagCross); bsBDiagonal, bsCross, bsDiagCross);
{$ENDIF}
type
TFillStyle = TGraphicsFillStyle; TFillStyle = TGraphicsFillStyle;
TFillMode = (fmAlternate, fmWinding); TFillMode = (fmAlternate, fmWinding);
@ -524,10 +567,13 @@ type
private private
FHandle: HPen; FHandle: HPen;
FColor: TColor; FColor: TColor;
FPenHandleCached: boolean;
{$IFDEF UseFPCanvas}
{$ELSE}
FWidth: Integer; FWidth: Integer;
FStyle: TPenStyle; FStyle: TPenStyle;
FMode: TPenMode; FMode: TPenMode;
FPenHandleCached: boolean; {$ENDIF}
procedure FreeHandle; procedure FreeHandle;
protected protected
{$IFDEF UseFPCanvas} {$IFDEF UseFPCanvas}
@ -538,9 +584,9 @@ type
function GetHandle: HPEN; function GetHandle: HPEN;
procedure SetHandle(const Value: HPEN); procedure SetHandle(const Value: HPEN);
procedure SetColor(Value: TColor); procedure SetColor(Value: TColor);
procedure SetMode(Value: TPenMode); procedure SetMode(Value: TPenMode); {$IFDEF UseFPCanvas}override;{$ENDIF}
procedure SetStyle(Value: TPenStyle); procedure SetStyle(Value: TPenStyle); {$IFDEF UseFPCanvas}override;{$ENDIF}
procedure SetWidth(value: Integer); procedure SetWidth(value: Integer); {$IFDEF UseFPCanvas}override;{$ENDIF}
public public
constructor Create; {$IFDEF UseFPCanvas}override;{$ENDIF} constructor Create; {$IFDEF UseFPCanvas}override;{$ENDIF}
destructor Destroy; override; destructor Destroy; override;
@ -1827,6 +1873,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.163 2004/12/22 23:54:21 mattias
started TControl.AnchorSide started TControl.AnchorSide

View File

@ -79,7 +79,6 @@ var
begin begin
Rect := ClientRect; Rect := ClientRect;
Canvas.Brush.Color := Color; Canvas.Brush.Color := Color;
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Width := 1; Canvas.Pen.Width := 1;
DrawEdge(Canvas.Handle, Rect, BDR_RAISEDOUTER, BF_RECT); DrawEdge(Canvas.Handle, Rect, BDR_RAISEDOUTER, BF_RECT);
with TS do with TS do

View File

@ -60,10 +60,14 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
Procedure TPen.SetStyle(Value : TPenStyle); Procedure TPen.SetStyle(Value : TPenStyle);
begin begin
if FStyle <> Value if Style <> Value
then begin then begin
FreeHandle; FreeHandle;
FStyle := Value; {$IFDEF UseFPCanvas}
inherited Style := Value;
{$ELSE}
FStyle:=Value;
{$ENDIF}
Changed; Changed;
end; end;
end; end;
@ -77,9 +81,14 @@ end;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
Procedure TPen.SetMode(Value : TPenMode); Procedure TPen.SetMode(Value : TPenMode);
begin begin
if FMode <> Value if Mode <> Value
then begin then begin
FMode := Value; FreeHandle;
{$IFDEF UseFPCanvas}
inherited Mode := Value;
{$ELSE}
FMode:=Value;
{$ENDIF}
Changed; Changed;
end; end;
end; end;
@ -96,7 +105,11 @@ begin
if Width <> Value if Width <> Value
then begin then begin
FreeHandle; FreeHandle;
FWidth := Value; {$IFDEF UseFPCanvas}
inherited Width := Value;
{$ELSE}
FWidth:=Value;
{$ENDIF}
Changed; Changed;
end; end;
end; end;
@ -111,11 +124,17 @@ end;
constructor TPen.Create; constructor TPen.Create;
begin begin
inherited Create; inherited Create;
FWidth := 1;
FHandle := 0; FHandle := 0;
{$IFDEF UseFPCanvas}
inherited Width := 1;
inherited Style := psSolid;
inherited Mode := pmCopy;
{$ELSE}
FWidth := 1;
FStyle := psSolid; FStyle := psSolid;
FColor := clBlack;
FMode := pmCopy; FMode := pmCopy;
{$ENDIF}
Color := clBlack;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -188,8 +207,8 @@ begin
FillChar(LogPen,SizeOf(LogPen),0); FillChar(LogPen,SizeOf(LogPen),0);
with LogPen do with LogPen do
begin begin
lopnStyle := PEN_STYLES[FStyle]; lopnStyle := PEN_STYLES[Style];
lopnWidth.X := FWidth; lopnWidth.X := Width;
lopnColor := FColor; lopnColor := FColor;
end; end;
CachedPen:=PenResourceCache.FindDescriptor(@LogPen); CachedPen:=PenResourceCache.FindDescriptor(@LogPen);
@ -256,6 +275,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $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 Revision 1.15 2004/12/22 23:54:21 mattias
started TControl.AnchorSide started TControl.AnchorSide

View File

@ -35,8 +35,8 @@ unit PairSplitter;
interface interface
uses uses
Classes, SysUtils, LCLType, LCLProc, LMessages, Graphics, GraphType, LCLIntf, Classes, SysUtils,
Controls; LCLType, LCLProc, LMessages, Graphics, GraphType, LCLIntf, Controls;
type type
TCustomPairSplitter = class; TCustomPairSplitter = class;

View File

@ -176,9 +176,16 @@ Type
end; end;
Const Const
cBrushStyle : Array[bsSolid..bsDiagCross] of String = ('bsSolid','bsClear','bsHorizontal', cBrushStyle : Array[TBrushStyle] of String =
'bsVertical','bsFDiagonal', {$IFDEF UseFPCanvas}
'bsBDiagonal','bsCross','bsDiagCross'); ('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 =( cFontPSMetrics : Array[0..12] of TFontPSMetrics =(