Delphi/CB
•  Greatis •  Security •  AppDatabase •  Utilities •  Visual Basic • .NET •  just4fun
Delphi / C++ Builder
Components, utilities and tips for Delphi and C++ Builder developers
More info
Object Inspector FAQ
Object Inspector Home
Delphi Components
See also
Products
Form Designer
Runtime Fusion
Print Suite
Commented Image
Image Editor  new!
Delphi Toys
Ultimate Pack  hot!

FAQs
Form Designer FAQ
Print Suite FAQ
Image Editor FAQ

Links
Software for .NET
Software for VB 6
Delphi Tips & Tricks

Services
Outsourcing
Translation the names and values
TComponentInspector allows to change the displayed names and values on-the-fly by OnGetName, OnGetValue and OnSetValue events. The following code changes all properties and makes them more "human" with adding the space before each upper case character, so, for instance, the "ActiveControl" property is displayed as "Active Control".
procedure TMainForm.ComponentInspectorGetName(Sender: TObject;
  TheIndex: Integer; var Value: String);
var
  i: Integer;
begin
  i:=1;
  while i<=Length(Value) do
  begin
    if IsCharUpper(Value[i]) then
    begin
      Insert(' ',Value,i);
      Inc(i);
    end;
    Inc(i);
  end;
end;
The values can be changed too, but two events must be used. The following code shows how the "True" and "False" values can be replaced by "Yes" and "No".
procedure TMainForm.ComponentInspectorGetValue(Sender: TObject;
  TheIndex: Integer; var Value: String);
var
  Prop: TProperty;
begin
  if Sender is TComponentInspector then
    with TComponentInspector(Sender) do
    begin
      Prop:=Properties[TheIndex];
      if Assigned(Prop) and (Prop.PropType=TypeInfo(Boolean)) and
        (InplaceEditorType[TheIndex]<>ieCheckBox) then
        if AnsiUpperCase(Value)='TRUE' then Value:='Yes'
        else Value:='No';
    end;
end;

procedure TMainForm.ComponentInspectorSetValue(Sender: TObject;
  TheIndex: Integer; var Value: String; var EnableDefault: Boolean);
var
  Prop: TProperty;
begin
  if Sender is TComponentInspector then
    with TComponentInspector(Sender) do
    begin
      Prop:=Properties[TheIndex];
      if Assigned(Prop) and (Prop.PropType=TypeInfo(Boolean)) and
        (InplaceEditorType[TheIndex]<>ieCheckBox) then
        if AnsiUpperCase(Value)='YES' then Value:='True'
        else Value:='False';
    end;
end;
As the used Boolean properties have the drop-down list with the "True" and "False" in the list, the values in the list must be changed too. It can be realized with the OnGetValuesList event.
procedure TMainForm.ComponentInspectorGetValuesList(Sender: TObject;
  TheIndex: Integer; const Strings: TStrings);
var
  Prop: TProperty;
begin
  if Sender is TComponentInspector then
    with TComponentInspector(Sender) do
    begin
      Prop:=Properties[TheIndex];
      if Assigned(Prop) and (Prop.PropType=TypeInfo(Boolean)) and
        Assigned(Strings) then Strings.Text:='No'#13'Yes';
    end;
end;

Greatis Software Greatis | Security | AppDatabase | Utilities | Delphi/CB | Visual Basic | .NET | just4fun

Contacts | Add to Favorites | Recommend to a Friend | Privacy Policy | Copyright © 1998-2008 Greatis Software