?
Solved

Adding Property to component - what am I doing wrong

Posted on 2003-03-24
15
Medium Priority
?
357 Views
Last Modified: 2013-11-23
I am trying to add a property to a component, so I can set it in the object inspector at design time, but I can't get the property to appear.

Here is a simple example using a TButton descendant.

type
  TbtnPaySysButton = class(TButton)
  private
    { Private declarations }
    flPassEnabled: boolean;
  protected
    { Protected declarations }
  public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
  published
    { Published declarations }
    property lPassEnabledToControls: boolean read flPassEnabled write flPassEnabled;  
  end;

Why can't I see the lPassEnabledToControls property in the object inspector?


0
Comment
Question by:DCLSyntect
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
15 Comments
 
LVL 1

Expert Comment

by:jbshumate
ID: 8200194
How are you creating the component.  To use the object inspector the component needs to be a design time component.  If you are dynamically creating it then you will not be able to see it.  To make it a design time component you must register it with the ide.  The help file can give you specific instructions for how to do this depending on which version of delphi you have.
0
 

Author Comment

by:DCLSyntect
ID: 8200213
I am using Delphi 7

The components are registered on the palette so I can drop them on forms - is that what you meant?
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8200521
Hi DCLSyntect
all seems fine in code.

try to right mouse click on object inspector bottom line.
follow "view" submenu and check all positions.

____
Igor
0
Independent Software Vendors: 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!

 

Author Comment

by:DCLSyntect
ID: 8200549
Thanks for your help - it seems to be working now for the TButton.  Does this also work for a frame or form?  I originally encountered this problem on a form & frame, and copied the code from there to the button.
0
 
LVL 9

Accepted Solution

by:
ITugay earned 400 total points
ID: 8200589
you have to use RegisterCustomModule

Procedure Register;
begin
 RegisterCustomModule( TMyForm, TCustomModule );
end;

see relative question:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20226186.html
0
 

Author Comment

by:DCLSyntect
ID: 8200619
Thanks ITugay

I don't see this procedure in the help anywhere.
I assume it replaces RegisterComponent. (?)

Where does the form appear in the IDE?
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8200684
procedure located in DesignIntf unit.
Do not forget to create .dpr and then add 'designide.dcp' to 'requires' section.

____
Igor
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8200690
Do not forget to place your form to object repository ('right mouse click on form and 'add to repositroy...')
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8200700
your form will be available in 'File | New | Other' Delphi menu
under the tab with name you gave while adding the form to repository.
0
 

Author Comment

by:DCLSyntect
ID: 8200809
Thanks ITugay

I ran into problems not being able to find Proxies.pas after adding DesignIntf & Designers to my Users clause

Where to I add to the "requires" section of a dpr ?

0
 
LVL 9

Expert Comment

by:ITugay
ID: 8200895
I'm sorry, I mean .dpk file.

>> I ran into problems not being able to find Proxies.pas .....

There is a liitle bit difficult to explan at once how to build designtime + runtime packages. I will send you some links with explanations. I just need to recall location. Just a moment.

____
Igor


0
 
LVL 9

Expert Comment

by:ITugay
ID: 8200902
0
 

Author Comment

by:DCLSyntect
ID: 8207788
Thanks ITugay

It took a while but all appears to be working now
0
 

Author Comment

by:DCLSyntect
ID: 8207851
Hi again

I have another question.
My properties are visible on descendant classes of forms & frames, but not on the original class.

EG:  MYFrame has a property lPassEnabled.
This is not shown in the object inspector for MyFrame, but when I create a new frame MyNewFrame based on MyFrame, the property is visible in the object inspector for MyNewFrame.

Is this normal?
Do I have to initialise the property in the form / frame create procedure?  If so, when does a user change to the property take affect?
0
 
LVL 9

Expert Comment

by:ITugay
ID: 8209627
Hi DCLSyntect
seems you have to inherit your form from objectrepository (not copy).
not sure about this.

___
Igor
0

Featured Post

Independent Software Vendors: 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

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…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month12 days, 17 hours left to enroll

777 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