Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TControl property?

Status
Not open for further replies.

bbresc512

Programmer
Mar 10, 2004
4
CA
Hi all
I've built a component where one of it's published properties is of type TControl. I'm able to select the value in the Object Inspector (it even displays the list of available TControl components that are currently on the form). The problem occurs when I remove the control - the Object Inspector gets confused and thows a bunch of exceptions. From this point on nothing can be done but abnormally ending Delphi IDE. Here is the component code:
TMyPanel = class(TPanel)
private
{ Private declarations }
FControl : TControl;
published
{ Published declarations }
property Control : TControl read FControl write FControl;
end;

Any ideas?
Thanks in advance.
 
the actual component code is this:
unit MyPanel;

interface

uses
SysUtils, Classes, Controls, ExtCtrls;

type
TMyPanel = class(TPanel)
private
{ Private declarations }
FControl : TControl;
FFieldName : string;
FFieldDesc : string;
published
{ Published declarations }
property Control : TControl read FControl write FControl;
property FieldName : string read FFieldName write FFieldName;
property FieldDesc : string read FFieldDesc write FFieldDesc;
end;

procedure Register;

implementation

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

end.

Strangely enough it worked when the Control property was published along. As soon as I added the other two properties the problem started again. Looks like a bug in Delphi IDE. I'm on Delphi 7 with the last update.
The way to reproduce:
1. Compile the component
2. put it an a form
3. put CheckBox control on the form
4. In Object Inspector, set the panel's Control property to CheckBox1
5. Delete CheckBox1

Any ideas on a workaround?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top