Para modificar enumerados automaticamente
Function ModifyEnum(C:TObject; Propertie:String; ValueProp:String;
Add:Boolean):Integer;
var vTypeInfo:PTypeInfo;
I:Integer;
P:PPropInfo;
OP :Integer;
begin
P := GetPropInfo(C, Propertie);
if P <> nil then
begin
Result:=GetOrdProp(C,P);
OP := GetEnumValue(GetTypeData(P^.PropType^)^.CompType^, ValueProp);
if Add then
TIntegerSet(Result) := TIntegerSet(Result) + [OP]
else
TIntegerSet(Result) := TIntegerSet(Result) - [OP];
end;
SetOrdProp(C, Propertie, Result);
end;
Use this way
active
ModifyEnum(Panel1 {TPanel}, 'Anchors', 'akLeft', True)
Desactive
ModifyEnum(Panel1 {TPanel}, 'Anchors', 'akLeft', False)

0 Comments:
Post a Comment
<< Home