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
Enumeration properties
TProperty class allows to get all information about enumeration-type properties using EnumCount, Names and Values properties. The EnumCount property contains the item count of the used enumeration type and the Names and Values properties allow to convert the integer value to the item indentifier and vice versa.
procedure TForm1.FormClick(Sender: TObject);
var
  P: TProperty;
begin
  with TPropertyList.Create(nil) do
  try
    Instance:=Self;
    Root:=Self;
    P:=FindProperty('BorderStyle');
    if Assigned(P) then
      with P do
      begin
        ShowMessage('BorderStyle''s item count is '+IntToStr(P.EnumCount));
        ShowMessage('Second item of BorderStyle is '+P.Names[1]);
        ShowMessage('bsDialog index in the BorderStyle is '+
          IntToStr(P.Values['bsDialog']));
      end;
  finally
    Free;
  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