 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Alex Liberov Guest
|
Posted: Wed Dec 27, 2006 4:49 am Post subject: How to get tkType - type property |
|
|
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
|
Posted: Thu Dec 28, 2006 9:12 am Post subject: Re: How to get tkType - type property |
|
|
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
|
Posted: Fri Dec 29, 2006 1:40 am Post subject: Re: How to get tkType - type property |
|
|
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
|
Posted: Wed Jan 03, 2007 12:26 am Post subject: Re: How to get tkType - type property |
|
|
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 |
|
 |
|
|
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
|
|