delphi - Is it possible? TCollection descendant to implement storage of TPanel containers with arbitrary content -


I'm new to component development in Delphi, so want to know, it is possible to implement my work at all. / P>

I need to create visual component (user control) based on TScrollBox, which will represent a group of TPanel, all those panels will be aligned as "top" inside that TScrollBox and separate height It is possible to work as TCollection (add, delete reader), and users will have to allow other controls to be added in these panels in design time.

I have created these sections for components:

  type TPanelsGrid = class; TPanelsGridItem = Class (TCollectionItem) Private FPanel: TPanel; Process SetPanel (Cost: Teppenal); Getgrid Function: Tappenels Grid; Protected function GetDisplayName: string; Override; Create Public Constructor (collection: TCollection); Override; Destruction of Destruction; Override; Assign the process (source: tipersistent); Override; This is my TPanel object that should be used in DesignTime / 1 / I thought "Sersted True" will automatically serialize it but I had the wrong property panel: TPNell writes Fennell Setpanel has been archived True is; End; TPanelsGridItems = Class (TCollection) Private FPanelsGrid: TPanelsGrid; Protected function GetItem (index: integer): TPanelsGridItem; Process set (index: integer; value: teplenels grid eighth); Function GetOwner: TPersistent; Override; Process update (item: TCollectionItem); Override; Public Property Editors Grid: Read TPNSGrig FPanelsGrid; Property Items [Index: Integer]: Write to GetItem for Teplenels Grid eTam SetItem; Default; Build Constructor (Panelsgrid: Typencil's Grid); Add function: TPanelsGridItem; Delete process (index: integer); End; TPanelsGrid = Class (TScrollBox) Private files: TPanelsGridItems; Process set items (value: tepnelsgrid items); Build a Public Builder (AOwner: TComponent); Override; Destruction of Destruction; Override; Published property items: TPanelsGridItems FItems writes SetItems; End;  

This component is working fine on design time, I can add and remove the panel in the stack, when I leave some control (like TCheckbox) on any panel, it "The panel is displayed in its ownership": For example, I can not drag this checkbox outside the panel.

But this checkbox is not stored in DFM-file and is not displayed in the "Structure" window.

I think there should be some manual serialization-deserization of TPNL content, but I do not know how to do it. No examples can be found on the internet if some such implementation is possible, give me some guidelines.

Code> Object Panels Grid 1: TnpNealgrid Left = 8 Head = 8 Width = 536 Altitude = 382 Anchor = [akLeft, akTop, akRight, akBottom] TabOrder = 0 items = & lt; Item end items end item end & gt; Finally

As you can see, all the items are empty, but I left a checkbox and radiobutton in item # 3. After the "itemprop =" text ">

I set up an appropriate implementation within Delphi sources inside Control ExtCtrls. Custom ClientPanel Group maintains a panel pile that can be added or removed at design time and runtime. I created my classes, using the source code of TCIMTCApTpinal group and TCEMTCARTP and it works like I would like.


Comments