 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
murn Guest
|
Posted: Wed Nov 12, 2003 12:16 pm Post subject: How to limit droped components |
|
|
How to limit components that are droped on my component in design time?
I tryed :
procedure TMyComponent.Notification(AComponent: TComponent; Operation:
TOperation);
begin
if csDesigning in ComponentState then
if Operation = opInsert then
if (AComponent.ClassName <> 'TMy2ndComponent') then
begin
MessageBox(Application.Handle,PChar('Not
allowed!'),PChar('Error !'),MB_OK);
AComponent.Free;
end;
inherited Notification(AComponent,Operation);
end;
;but this couses access violation.
Regards Milos
|
|
| Back to top |
|
 |
Maris Janis Vasilevskis Guest
|
Posted: Wed Nov 12, 2003 1:54 pm Post subject: Re: How to limit droped components |
|
|
Notification is called from TMy2ndComponent.Create, so it is not ready for
Free yet. Raise exception.
Mahris
murn wrote:
| Quote: | How to limit components that are droped on my component in design time?
I tryed :
procedure TMyComponent.Notification(AComponent: TComponent; Operation:
TOperation);
begin
if csDesigning in ComponentState then
if Operation = opInsert then
if (AComponent.ClassName <> 'TMy2ndComponent') then
begin
MessageBox(Application.Handle,PChar('Not
allowed!'),PChar('Error !'),MB_OK);
AComponent.Free;
end;
inherited Notification(AComponent,Operation);
end;
;but this couses access violation.
Regards Milos
|
|
|
| Back to top |
|
 |
Marc Rohloff Guest
|
Posted: Wed Nov 12, 2003 2:05 pm Post subject: Re: How to limit droped components |
|
|
On Wed, 12 Nov 2003 13:16:40 +0100, murn<miloo (AT) email (DOT) si> said ...
| Quote: | How to limit components that are droped on my component in design time?
Override the ValidateInsert method of TComponent and throw an exception. |
Marc
|
|
| Back to top |
|
 |
murn Guest
|
Posted: Fri Nov 14, 2003 8:05 am Post subject: Re: How to limit droped components |
|
|
Hi,
| Quote: | Override the ValidateInsert method of TComponent and throw an exception.
|
I did !
Thank you all !
Regards Milos
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|