Solved

Component Building Problem

Posted on 2000-05-03
7
124 Views
Last Modified: 2011-08-18
I need to make a component that when you use object inspector you see information in groups.

 I.E. there is a little + symbol beside each group and when you double click on it, you can edit the data in that group.

 I.E. When you put a label on a form, and edit the label with the object inspector(window) you see...

Align
Alignment
+Anchors
AutoSize

If someone can give me a very simple working component that does this that would be great. I Will give more points depending on the answer.

My component has to look like this...

MyComponent
+DataA
      .ValueX : Integer
      .ValueY : Integer
+DataB
      .ValueX : Integer
      .ValueY : Integer
.Means : Integer
0
Comment
Question by:divnet
7 Comments
 

Expert Comment

by:netbeto
ID: 2775032
Hy divnet,
i don't have the right code now, but you just must to create the propert in the publich place and use array to make what you want.

hope to had give you a help,

cheers,

NetBeto
0
 
LVL 15

Expert Comment

by:simonet
ID: 2775072
You need to derive the class fom TPersistent and then make that class a property of your component.

Alex
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 2775340
I agree with simonet.
Do smth like this:

TPersistentData= class(TPersitent)
private
  FValueX: Integer;
  FValueY: Integer;
published
  ValueX: Integer read FValueX write FValueX;
  ValueY: Integer read FValueY write FValueY;
end;

TMyComponent= class(TComponent)
privte
  FDataA, FDataB: TPersitentData;
public
  constructor Create(AOwner: TComponent); override; // create your persistent objects in the constructor
  destructor Destroy; override; // and destroy them before destroying the component
published
  DataA: TPerstentData read FDataA;
  DataB: TPerstentData read FDataB;
end;

Regards, ptm.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:ptmcomp
ID: 2775345
Seams that my computer is hungry and eat some chars... >;o)
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 100 total points
ID: 2775348
Here is a working example (derived from TPanel) that should help you on the right track:


unit MyPanel;

interface

uses  
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls;

type
  TMyProperty = class(TPersistent)
  private
    { Private declarations }
    FValue1: Integer;
    FValue2: Integer;
    FValue3: Boolean;
  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    { Published declarations }
    property Value1: Integer read FValue1 write FValue1;
    property Value2: Integer read FValue2 write FValue2;
    property Value3: Boolean read FValue3 write FValue3;
  end;

  TMyPanel = class(TPanel)
  private
    { Private declarations }
    FMyProperty: TMyProperty;
  protected
    { Protected declarations }
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    { Published declarations }
    property MyProperty: TMyProperty read FMyProperty write FMyProperty;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Epsylon', [TMyPanel]);
end;

{ TMyPanel }

constructor TMyPanel.Create(AOwner: TComponent);
begin
  inherited;
  FMyProperty := TMyProperty.Create;
end;

destructor TMyPanel.Destroy;
begin
  inherited;
  FMyProperty.Free;
end;

end.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2775355
Sorry ptm, didn't see you comment   :o)

my code is complete though....
0
 
LVL 10

Expert Comment

by:ptmcomp
ID: 2778045
There are only two minutes between posting the comments >8o|
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question