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 get tkType - type property

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OpenToolsAPI
View previous topic :: View next topic  
Author Message
Alex Liberov
Guest





PostPosted: Wed Dec 27, 2006 4:49 am    Post subject: How to get tkType - type property Reply with quote



Hi,

I'm using Delphi 5. I have IOTAComponent on a form that has a property,
that specifies component on another form which may or may not be open
at present time. The property is of type tkType.
How can I get the name of the form which contains the referred component
and how can I get the name of that component?

Thanks in advance,

Alexander Liberov.
Back to top
Erik Berry
Guest





PostPosted: Thu Dec 28, 2006 9:12 am    Post subject: Re: How to get tkType - type property Reply with quote



Alex Liberov wrote:
Quote:
I'm using Delphi 5. I have IOTAComponent on a form that has a property,
that specifies component on another form which may or may not be open
at present time. The property is of type tkType.
How can I get the name of the form which contains the referred component
and how can I get the name of that component?

IOTAComponent.GetComponentHandle gives you access to the physical
reference/pointer to a component. You can cast the result to a either
TPersistent/TComponent and then operate on it using the normal properties
defined in the VCL/RTL such as checking the class/object name, performing
RTTI, calling GetParentForm, etc. If the property in question is a direct
reference/pointer to another component, the IDE auto-loads the form for you
in the background, even if it is not visibly open.

Erik
Back to top
Alex Liberov
Guest





PostPosted: Fri Dec 29, 2006 1:40 am    Post subject: Re: How to get tkType - type property Reply with quote



It doesn't open containing form automatically. I need to pre-open it
manually or else I'm getting an AV. Is there another way to do it?

The name of the referenced component is stored in DFM file. Is there
some ready tool to parse DFM file and extract a property string from it?

Alexander Liberov.


Erik Berry wrote:
Quote:
Alex Liberov wrote:
I'm using Delphi 5. I have IOTAComponent on a form that has a
property, that specifies component on another form which may or may
not be open at present time. The property is of type tkType.
How can I get the name of the form which contains the referred
component and how can I get the name of that component?

IOTAComponent.GetComponentHandle gives you access to the physical
reference/pointer to a component. You can cast the result to a either
TPersistent/TComponent and then operate on it using the normal
properties defined in the VCL/RTL such as checking the class/object
name, performing RTTI, calling GetParentForm, etc. If the property in
question is a direct reference/pointer to another component, the IDE
auto-loads the form for you in the background, even if it is not visibly
open.

Erik
Back to top
Erik Berry
Guest





PostPosted: Wed Jan 03, 2007 12:26 am    Post subject: Re: How to get tkType - type property Reply with quote

Alex Liberov wrote:
Quote:
It doesn't open containing form automatically. I need to pre-open it
manually or else I'm getting an AV. Is there another way to do it?

Try opening the file "automatically" using the OTA.

Quote:
The name of the referenced component is stored in DFM file. Is there
some ready tool to parse DFM file and extract a property string from it?

The undocumented TParser in the RTL is built for this. You might also
search around for other third-party DFM parsers in CodeCentral, Torry's, etc.

Erik
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OpenToolsAPI 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.