Can I use variant property? lazarus / 31-LCL ---------------------------------------------------------------------- korba812 · 2016-05-15 09:56 Hi! How can I use and store variant property in LFM? I tried something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit TestComponent; {$mode objfpc}{$H+} interface uses  Classes, SysUtils; type   { TTestComponent }   TTestComponent = class(TComponent)  private    { Private declarations }    FVarProp: Variant;    procedure ReadVarProp(AReader: TReader);    procedure WriteVarProp(AWriter: TWriter);  protected    { Protected declarations }    procedure DefineProperties(Filer: TFiler); override;  public    { Public declarations }  published    { Published declarations }    property VarProp: Variant read FVarProp write FVarProp;  end; procedure Register; implementation procedure Register;begin  RegisterComponents('Test',[TTestComponent]);end; { TTestComponent } procedure TTestComponent.ReadVarProp(AReader: TReader);begin  FVarProp := AReader.ReadVariant;end; procedure TTestComponent.WriteVarProp(AWriter: TWriter);begin  AWriter.WriteVariant(FVarProp);end; procedure TTestComponent.DefineProperties(Filer: TFiler);begin  inherited DefineProperties(Filer);  Filer.DefineProperty('VarProp', @ReadVarProp, @WriteVarProp, True);end; end.But I can't edit property in obect inspector and can't store it to LFM because TLRSObjectReader/TLRSObjectWriter have no implemented functions WriteVariant/ReadVariant. So, how can I use variant properties? ---------------------------------------------------------------------- Bart · 2016-05-15 10:11 Don't publish them? Bart ---------------------------------------------------------------------- korba812 · 2016-05-15 10:27 This is a solution, but unfortunately I need to be able to edit such properties at design time. ---------------------------------------------------------------------- Thaddy · 2016-05-15 10:48 If variants generate/can generate  rtti with sufficient info (publishable), you can write your own property editor that handles the variants (would be a very, very, very complex one) . In DXE7+ this is possible, don't know about lazarus. To me it is a bit counter-intuitive to have variants edited at design time. Another approach is to handle the variants that you expect as sub- properties that are mutually exclusive. ---------------------------------------------------------------------- korba812 · 2016-05-15 12:03 It seems that this functionality has not been implemented yet. I found TVariantPropertyEditor, but it looks unfinished. It seems that it should not be difficult. I'll try.