Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-01

Stream a property (string) of a TCollection derived component to LFM

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bart

Hi,

I'm stuck.

Consider this situation.

type
  TTitle = class(TPersistent)
  ....
  published
    property Caption: String read GetCaption write SetCaption stored
IsCaptionStored;
  end;
  TItem = class(TCollectionItem)
  ...
  public
    property Title: TTitle read GetTitle write SetTitle;
  end;
  TCol = class(TCollection)
  private
    FProp: String;
    ...
    function IsPropStored;  //returns True
    ...
  published
    ...
    property Prop: String read FProp write FProp stored IsPropStored;
    property Items[Index: Integer]: TItem read GetItem write SetItem; default;
  end;
  TExample = class(TCustomControl)
  private
    FCol: TCol;
  ...
  published
    ...
    property Col: TCol read GetCol write GetCol stored IsColStored;
  end;

Now I drop a TExample on a form.
In OI I click on property Col and add some items.
I save the project and restart Lazarus and my Col property properly has its Items.

    Col = <
      item
        Title.Caption = 'Title'
      end
      item
        Title.Caption = 'Title'
      end>

However the property Prop does not get written to the LFM. FWIW: All of the IsXXXStored functions return True.

(For those who rather know what I'm actually doing:

- TExample = TCustomGrid
- TCol = TGridColumns
- TItem = TGridColumn
- TTitle = TGridColumnTitle

I want to implement a published DefaultCaption: string; property for TGridColums.
)

How do I make that work?
Do I need to override TExample.DefineProperties?

Bart

Reply by email

FreeMan
to Bart

Hello,
TCollection doesn't call writeproperties, I was lookfor as long as one month :) Use this patch,
http://bugs.freepascal.org/view.php?id=25048
I didn't understand still not apply this mattias's patch to orginal source and bug report still opened

12-01-2014 17:39 tarihinde, Bart yazd?:

Show quoted text 11 lines
How do I make that work? Do I need to override TExample.DefineProperties? Bart -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Flávio Etrusco
to FreeMan

The ticket must be moved/reassgined to Free Pascal project. However I'm wondering how code that invokes
"ObjValue.InheritsFrom(TPersistent)" is working, considering "InheristFrom" is a class function and "ObjValue" is TObject...

-Fl?vio

FreeMan wrote 27 lines
Hello, TCollection doesn't call writeproperties, I was lookfor as long as one month :) Use this patch, http://bugs.freepascal.org/view.php?id=25048 I didn't understand still not apply this mattias's patch to orginal source and bug report still opened 12-01-2014 17:39 tarihinde, Bart yazd?: > How do I make that work? > Do I need to override TExample.DefineProperties? > > Bart > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Flávio Etrusco
to Flávio Etrusco
Fl?vio Etrusco wrote 5 lines
However I'm wondering how code that invokes "ObjValue.InheritsFrom(TPersistent)" is working, considering "InheristFrom" is a class function and "ObjValue" is TObject... -Fl?vio

Sorry, brainfart.

-Fl?vio

Reply by email