Solved

Component Building Problem

Posted on 2000-05-03
7
122 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to convert wav to mp3 in delphi 9 197
Delphi...Split view - idea? 1 67
PHP preg_replace code convert to Delphi 14 55
Slow Restore if incremental backups using RDiff.exe 4 17
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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…

786 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