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 

TComponent

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





PostPosted: Sat Nov 08, 2003 7:39 pm    Post subject: TComponent Reply with quote



Hello,

I have one main control and child controls (TComponent desc.)

I have PropertyEditor for working with this childrens too.

When I want to add new child component into main component I simply Create
this component with setting Parent to main component. And I have one:

Items[x]: TMyChildComponent

property for accesing to this child components.

And that work fine in design and run-time. In design time I add component
same as in run-time by calling Add method of main component.

But how to make that when user set name of this child component in
ObjectInspector using PropertyEditor to this component is inserted in code
like all delphi components? And how to acces to this component with their
name in code.

type
TForm1 = class(TForm)
< my child component to be placed here >
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

Currently I can acces to my child component only by my own
MainControl.Items[x]; but how to do ChildControlName.Something;

Also, when I create event for child component all work fine until I delete
body of this event and click on run or save. In this moment event disapear
(normal) but my child control still point to this event and delphi show
error when start program.

How to solve all this, do I need to use something in IDesigner? When I add
component in DesignTime with calling Create why this component is not added
to code editor too.

Thanks
Bokini


Back to top
Ignacio Vazquez
Guest





PostPosted: Sat Nov 08, 2003 8:05 pm    Post subject: Re: TComponent Reply with quote



Hello, Bokini!
You wrote on Sat, 8 Nov 2003 20:39:37 +0100:
Quote:
Currently I can acces to my child component only by my own
MainControl.Items[x]; but how to do ChildControlName.Something;

You can't since it's dynamically created.

Cheers,
Ignacio



Back to top
Bokini
Guest





PostPosted: Sat Nov 08, 2003 8:27 pm    Post subject: Re: TComponent Reply with quote



Hello,

So, how to solve this, I saw in other components that this is possible
(Toolbar2000 for example)

Best regards
Bokini

"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote

Quote:
Hello, Bokini!
You wrote on Sat, 8 Nov 2003 20:39:37 +0100:
Currently I can acces to my child component only by my own
MainControl.Items[x]; but how to do ChildControlName.Something;

You can't since it's dynamically created.

Cheers,
Ignacio





Back to top
Ignacio Vazquez
Guest





PostPosted: Sat Nov 08, 2003 8:32 pm    Post subject: Re: TComponent Reply with quote

Hello, Bokini!
You wrote on Sat, 8 Nov 2003 21:27:56 +0100:
Quote:
So, how to solve this, I saw in other components that this is possible
(Toolbar2000 for example)

It fakes it by using descendants of TCollection and TCollectionItem along
with a custom property editor.

Cheers,
Ignacio



Back to top
Bokini
Guest





PostPosted: Sat Nov 08, 2003 9:08 pm    Post subject: Re: TComponent Reply with quote

Hello

I don't think so. TTBItem is TComponent desc.

check on www.jrsoftware.org

"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote

Quote:
Hello, Bokini!
You wrote on Sat, 8 Nov 2003 21:27:56 +0100:
So, how to solve this, I saw in other components that this is possible
(Toolbar2000 for example)

It fakes it by using descendants of TCollection and TCollectionItem along
with a custom property editor.

Cheers,
Ignacio





Back to top
Ignacio Vazquez
Guest





PostPosted: Sat Nov 08, 2003 10:11 pm    Post subject: Re: TComponent Reply with quote

Hello, Bokini!
You wrote on Sat, 8 Nov 2003 22:08:02 +0100:
Quote:
I don't think so. TTBItem is TComponent desc.

In that case they don't use a TCollection, but they still use a custom
property editor.

Cheers,
Ignacio



Back to top
Bokini
Guest





PostPosted: Sat Nov 08, 2003 11:02 pm    Post subject: Re: TComponent Reply with quote

Hello,

Yes I know, and as I have write in my first post and I am using custom
property editor (TDesignWindow), so that is not a problem

"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote

Quote:
Hello, Bokini!
You wrote on Sat, 8 Nov 2003 22:08:02 +0100:
I don't think so. TTBItem is TComponent desc.

In that case they don't use a TCollection, but they still use a custom
property editor.

Cheers,
Ignacio





Back to top
Ignacio Vazquez
Guest





PostPosted: Sat Nov 08, 2003 11:15 pm    Post subject: Re: TComponent Reply with quote

Hello, Bokini!
You wrote on Sun, 9 Nov 2003 00:02:44 +0100:
Quote:
Yes I know, and as I have write in my first post and I am using custom
property editor (TDesignWindow), so that is not a problem

Ah, sorry. Missed that bit.

Wait, I think I know now. You probably have to set the owner of the
component to the form itself instead of the component. Give that a try.

Cheers,
Ignacio



Back to top
Ignacio Vazquez
Guest





PostPosted: Mon Nov 10, 2003 9:07 pm    Post subject: Re: TComponent Reply with quote

"Bokini" <nikolicbojanat (AT) hotmail (DOT) com> wrote in message
[email]3fad46a1 (AT) newsgroups (DOT) borland.com[/email]...
Quote:
How to solve all this, do I need to use something in IDesigner? When I add
component in DesignTime with calling Create why this component is not
added to code editor too.

I found the answer when looking for one of my own:

http://delphi.about.com/library/bluc/text/uc092501d.htm

Check the section entitled "Advanced property editors".

Cheers,
Ignacio

--
The strange part isn't so much that he had an accent. No accent was
detectable. It was just sounds and burbs and gurgles coming from him. He
was a like a chubby, old R2-D2.
- La Üter



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.