BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to limit droped components

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing
View previous topic :: View next topic  
Author Message
murn
Guest





PostPosted: Wed Nov 12, 2003 12:16 pm    Post subject: How to limit droped components Reply with 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
Maris Janis Vasilevskis
Guest





PostPosted: Wed Nov 12, 2003 1:54 pm    Post subject: Re: How to limit droped components Reply with quote



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





PostPosted: Wed Nov 12, 2003 2:05 pm    Post subject: Re: How to limit droped components Reply with quote



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





PostPosted: Fri Nov 14, 2003 8:05 am    Post subject: Re: How to limit droped components Reply with quote

Hi,

Quote:
Override the ValidateInsert method of TComponent and throw an exception.

I did !

Thank you all Smile!

Regards Milos



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi VCL Components Writing All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.