Thread View: borland.public.csharpbuilder.ide.general
5 messages
5 total messages
Started by Francois PIETTE [ICS - MidWare]
Thu, 03 Aug 2006 16:25
Accessing the component "Name" property
Author: Francois PIETTE [ICS - MidWare]
Date: Thu, 03 Aug 2006 16:25
Date: Thu, 03 Aug 2006 16:25
21 lines
1849 bytes
1849 bytes
When I create a component (A classe deriving from System.ComponentModel.Component) and install it in the IDE, I see there is a Name property shown in the object inspector. This property is displayed in parenthesis and doesn't seems to be accessible from my own code ! If I create a Name property myself, it works perfectly but the object inspector show my "Name" property and the his "(Name)" property (note the parenthesis). So my question is: How do I access the Name property shown by the object inspector or how can I have my Name property override the one shown by the obejct inspector ? Any advice appreciated. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- francois.piette@overbyte.be The author for the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be
Re: Accessing the component "Name" property
Author: Marc Rohloff TeamB
Date: Thu, 03 Aug 2006 22:53
Date: Thu, 03 Aug 2006 22:53
21 lines
1984 bytes
1984 bytes
On Thu, 3 Aug 2006 18:25:55 +0200, Francois PIETTE [ICS - MidWare] wrote: > When I create a component (A classe deriving from > System.ComponentModel.Component) and install it in the IDE, I see there is a > Name property shown in the object inspector. This property is displayed in > parenthesis and doesn't seems to be accessible from my own code ! > > If I create a Name property myself, it works perfectly but the object > inspector show my "Name" property and the his "(Name)" property (note the > parenthesis). > > So my question is: How do I access the Name property shown by the object > inspector or how can I have my Name property override the one shown by the > obejct inspector ? Basically you can't, all .NET components work the same way. -- Marc Rohloff [TeamB] marc rohloff -at- myrealbox -dot- com
Re: Accessing the component "Name" property
Author: Francois Piette [ICS & Midware]
Date: Fri, 04 Aug 2006 06:35
Date: Fri, 04 Aug 2006 06:35
29 lines
1980 bytes
1980 bytes
> > When I create a component (A classe deriving from > > System.ComponentModel.Component) and install it in the IDE, I see there is a > > Name property shown in the object inspector. This property is displayed in > > parenthesis and doesn't seems to be accessible from my own code ! > > > > If I create a Name property myself, it works perfectly but the object > > inspector show my "Name" property and the his "(Name)" property (note the > > parenthesis). > > > > So my question is: How do I access the Name property shown by the object > > inspector or how can I have my Name property override the one shown by the > > obejct inspector ? > > Basically you can't, all .NET components work the same way. I don't believe I can't access the "(Name)" property by code within the component class. I will ask on MS newsgroups... Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- francois.piette@overbyte.be Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) http://www.overbyte.be
Re: Accessing the component "Name" property
Author: Marc Rohloff TeamB
Date: Fri, 04 Aug 2006 16:33
Date: Fri, 04 Aug 2006 16:33
44 lines
2918 bytes
2918 bytes
From: "Marc Rohloff [TeamB]" <"on request"> Subject: Re: Accessing the component "Name" property Newsgroups: borland.public.csharpbuilder.ide.general User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit References: <44d223ec@newsgroups.borland.com> <m1p14y1fhmc$.dlg@dlg.marcrohloff.com> <44d2eafa@newsgroups.borland.com> Date: Fri, 4 Aug 2006 12:28:40 -0400 Message-ID: <wxacey3pdn8w$.dlg@dlg.marcrohloff.com> X-Face: "huzh55Xi]!ZNni78>a*5+).`SK?<^q2MlHk-C]Z2M9T@\J5ZCB$95Ey+s"XQuhGFA[eutZ :0^AV!Q;t>gE`1-=8d;HZ6~*o1dH<X9\b$!|(}+I'!Xq)@3Op}%0ArW&nf'Qh*EwR X-Antivirus: avast! (VPS 0631-2, 08/02/2006), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 65.31.1.121 X-Trace: newsgroups.borland.com 1154708920 65.31.1.121 (4 Aug 2006 09:28:40 -0700) Lines: 15 X-Authenticated-User: mrohloff Path: newsgroups.borland.com!not-for-mail Xref: newsgroups.borland.com borland.public.csharpbuilder.ide.general:1138 X-Antivirus: avast! (VPS 0631-2, 08/02/2006), Inbound message X-Antivirus-Status: Clean On Fri, 4 Aug 2006 08:35:15 +0200, Francois Piette [ICS & Midware] wrote: >> Basically you can't, all .NET components work the same way. > > I don't believe I can't access the "(Name)" property by code within the > component class. > I will ask on MS newsgroups... Sure, you could also check the help file, there is no name property for any .net component. The property editor makes this up based purely on the name of the variable it is assigned to in the initialization (hence the parentheses around the name). -- Marc Rohloff [TeamB] marc rohloff -at- myrealbox -dot- com
Re: Accessing the component "Name" property
Author: Francois PIETTE [ICS - MidWare]
Date: Fri, 04 Aug 2006 18:18
Date: Fri, 04 Aug 2006 18:18
50 lines
3175 bytes
3175 bytes
>>> Basically you can't, all .NET components work the same way.
>>
>> I don't believe I can't access the "(Name)" property by code within the
>> component class. I will ask on MS newsgroups...
>
> Sure, you could also check the help file, there is no name property
> for any .net component. The property editor makes this up based purely
> on the name of the variable it is assigned to in the initialization
> (hence the parentheses around the name).
OK, I've found where this property is located.
Actually it is a property of the ISite interface which is available thru
Component.Site property.
The Site property has a value only when the component is dropped on a form
(owned by a container). So to use that property, you can write the code
below:
[Browsable(false)]
public string Name {
get { if (Site == null)
return FName;
else
return Site.Name;
}
set { FName = value;
if (Site != null)
Site.Name = FName;
}
}
protected string FName;
This code define a non browsable property (that is which doesn't appears in
the object inspector and is mapped to the Site.Name property when Site is
assigned. If not, it is mapped to a protected string member.
This implementation perfectly fit my need: When a component is dropped on a
form, it has a value for Site.Name which is available thru the Name property
I created. When the component is created at runtime, it has a the property
Name which is mapped to the adequate storage.
I could enhance a little bit the implementation by overriding set_Site in
order to not loose the Name property value when the component is included
within a container. But this is not necessary for any use I have.
Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
francois.piette@overbyte.be
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads