KCL Design System - TKclObjInspector

MQY Studio

Version 1.00    

TKclObjInspector

  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

  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.
  The RTTI information of ActiveComponent's class.
  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.
  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.

  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.

  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.
  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.
  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.
  Property out put filter style: show properties or events or both.
  Event names that you want to display on KclObjInspector. If item count equals to zero, all events will be allowed to display.
  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.
  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

  Occurs when ActiveComponent or ActiveComponents changed.
  Occurs when OwnerComponent or OwnerComponents changed.
  Occurs when ActiveComponent's name property being changed by KclObjInspector.
  Occurs when KclObjInspector refresh itself.
  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 ;

  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

  Add AComponent to ActiveComponents list and refresh the output. Do not use code: ActiveComponents.Add(AComponent), use this method instead.
  Clear ActiveComponents list and refresh the output. Do not use code: ActiveComponents.Clear, use this method instead,
  Clear OwnerComponents list and refresh the output. Do not use code: OwnerComponents.Clear, use this method instead,
  Refresh KclObjectInspector's display.

Demos

SimpleObjInspector
DoubleObjInspector
DfmBuilder

MQY Studio 2002.12