Solved

Component Building Problem

Posted on 2000-05-03
7
120 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now