Error with Variant parameter when used attributes

Asked

Viewed 68 times

1

Good night! I have a problem with using attributes in Delphi, I have the following constructor:

constructor Create(Value: Variant; Operacoes: TCompare;
  Referencia: TReferenceCompare; Origem: String; Tipo: TVarType); overload;

and in the Value parameter of the following error message: "Could not Convert Variant of type (Error) into type (Olestr)".

Obs: when I change this parameter for a string works perfectly, I am calling it as follows:

[Tatributo('Edit4.Text', tcNotLess, rcObject, 'Text', varInteger)]

The message happens when I assign to a Property of my class, I’m having difficulty because the error happens only when I use it in the custom attribute constructor, when creating a method within my form for example, sure. I came across another error when using RTTI within the attribute class methods, when I declare to use RTTI after the attribute, it compiles, but it doesn’t work, to work just declare before the class declaration. So I’m suspecting that being a Tcustomattribute I have to use differently, but I have no knowledge of how to do this, could anyone help me? Thank you in advance. If anyone can explain too, or suggest a link where I can understand more about attributes I am grateful.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.