|
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;
|