KCL Design System - TKclObjInspector
|
|
Version 1.00
|
TKclObjInspector is a Control
similar to Delphi's Object Inspector. It can list/edit properties(events)
of object(s), use "Property Editors", conceal certain properties, translate
property names/values.
Unit
ObjInspect
Hierarchy
TObject - TPersistent - TComponent
-TControl - TWinControl - TCustomControl - TCustomGrid - TCustomDrawGrid
- TValueListEditor - TMqyValueListEditor -
TKclObjInspector
Properties
- ActiveComponents: TObjectList
Set ActiveComponents to make KclObjInspector
displays their properties / events, such as:
ObjInspector.ActiveComponents := ACompList;
Attention: if you use the following
code style:
ObjInspector.ActiveComponents.Add(AComponent);
it may not work normally, even raises.exceptions. Call method
AddActiveComponent instead.
- ClassInformation: TClassInformation
The RTTI information of ActiveComponent's
class.
- CurrPropItem: TObjInspecPropertyItem (ReadOnly)
Property information of the currently
selected row.
Whether the properties of ActiveComponents
has been modified. When you edit properties in KclObjInspector, Dirty will
be set to True. You have to manually set this property to False.
- OwnerComponents: TComponentList
Use this property to indicate the
DesignStage normally. For example, Label has a property of FocusControl
which points to a TWinControl. If this property is setted, the KclObjInspector
will list all TWinControl in OwnerComponents.
If item count of OwnerComponents is greater than one, KclObjInspector
will regard the first one as the "base" OwnerComponent. For example, if
OwnerComponents contains Form1 and Form2 while Form1 is the first item,
then you may find a list like:
Edit1
Button1
Form2.Memo1
Form2.Button1
Use the following sytanx to change OwnerComponents:
ObjInspector.OwnerComponents := AComponentList;
If you use the following code:
ObjInspector.OwnerComponents.Add(AComponent);
you should call method
Refresh
to activate the changes.
- ActiveComponent: TComponent
Set ActiveComponent to make KclObjInspector
displays its properties / events, such as:
ObjInspector.ActiveComponent := AComponent;
Set this property will discard any other components in
ActiveComponents property.
- AutoUpdateOutput: Boolean
Whether the KclObjInspector update
its display after ActiveComponent, ActiveComponts, OwnerComponent, OwnerComponents
and so on changes. If this property is set to False, you should manually
call method Refresh to refresh the
display.
- ConcealedEventNames: TStringList
Event names that you do not want
them to display on KclObjInspector. If OutputEventNames is setted, this property
will be ignored.
Attention: This property has no effect on property.
- ConcealedPropNames: TStringList
Property names that you do not want
them to display on KclObjInspector. If OutputPropertyNames is setted, this
property will be ignored.
Attention: This property has no effect on event.
- PropertyFilterStyles: TPropertyFilterStyles
Property out put filter style: show
properties or events or both.
- OutputEventNames: TStringList
Event names that you want to display
on KclObjInspector. If item count equals to zero, all events will be allowed
to display.
- OutputPropertyNames: TStringList
Property names that you want to
display on KclObjInspector. If item count equals to zero, all properties
will be allowed to display.
Whether translate property names/values
before displaying them on screen. You must set events:
OnTranslateIdent and OnTranslateToIdent
to implement translation job there.
- OwnerComponent: TComponent
Use this property to indicate
the DesignStage normally. For example, Label has a property of FocusControl
which points to a TWinControl. If this property is setted, the KclObjInspector
will list all TWinControl in OwnerComponent.
Setting OwnerComponent will clear any other items in
OwnerComponents property.
Events
- OnChangeActiveComponent: TNotifyEvent
Occurs when ActiveComponent or
ActiveComponents changed.
- OnChangeOwnerComponent: TNotifyEvent
Occurs when OwnerComponent or OwnerComponents
changed.
- OnPropNameChanged: TPropChangedEvent
Occurs when ActiveComponent's name
property being changed by KclObjInspector.
Occurs when KclObjInspector refresh
itself.
- OnTranslateIdent: TRttiTranslateEvent
Occurs when idents (property name,
enum consts and so on) are translate to your customized strings. You should
put your translation code here, for example:
procedure TForm1.ObjInspectorTranslateIdent(Sender: TObject;
PTI: PTypeInfo; Src: String; TransRole: TTransRole;
var Dest: String);
begin
if SameText(Src,
'True') then
Dest := '[YES]'
else
if SameText(Src, 'False') then
Dest := '[NO]'
else
if SameText(Src, 'Align') then
Dest := '[ALIGN]';
end
;
- OnTranslateToIdent: TRttiTranslateEvent
Occurs when your customized strings
are translate back to idents. You should put your translation code here, for
example:
procedure TForm1.ObjInspectorTranslateToIdent(Sender: TObject;
PTI: PTypeInfo; Src: String; TransRole: TTransRole;
var Dest: String);
begin
if SameText(Src,
'[YES]') then
Dest := 'True'
else
if SameText(Src, '[NO]') then
Dest := 'False'
else
if SameText(Src, '[ALIGN]') then
Dest := 'Align';
end;
Methods
constructor Create(AOwner:
TComponent); override;
destructor Destroy;
override;
procedure
AddActiveComponent(AComponent: TComponent);
Add AComponent to
ActiveComponents list and refresh the output. Do not use code: ActiveComponents.Add(AComponent),
use this method instead.
procedure ClearActiveComponents;
Clear
ActiveComponents list and refresh the output. Do not use code: ActiveComponents.Clear,
use this method instead,
procedure ClearOwnerComponents;
Clear
OwnerComponents list and refresh the output. Do not use code: OwnerComponents.Clear,
use this method instead,
procedure Refresh;
virtual;
Refresh KclObjectInspector's display.
Demos
SimpleObjInspector
DoubleObjInspector
DfmBuilder
MQY Studio 2002.12