Thanks folks for all the advice John Barrat
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stephen Posey Sent: 29 December 2006 04:16 To: Borland's Delphi Discussion List Subject: Re: Visibility and Scope John Barrat wrote: > I have a custom control which I have written which itself uses a sub > components and sub classes which I don't want to expose beyond the > Component. > > However, there are some aspects of these sub components I need to > expose as properties in the component. The problem I have is that > some of these properties are Enum types which are defined in the subcomponent. > > How can I get these Enums exposed to the Main application code using > the component? I have tried aliaising through the component but this > doesn't work. The only way I can get access to these types is by > referencing the subcomponents in the Uses section of the Main code. > > By way of example: > > I have a component TMultiCom which uses a subcomponent TComPort > TComPort has a Property of Enum Type BaudRate (comprising br1200, > br9600 > etc) I have a ComSettings property in my TMultiCom control which > includes the Enum property BaudRate. > > Without adding ComPort to my Uses section of my application how do I > make this Enum type available to my application? You can't, the type MUST be visible in order to use it. Given your description of the situation, my suggestion would be to place the enumeration (and any other such declarations) in a separate "definitions" unit that your components ("hidden" and otherwise) and your application can use. Stephen Posey [EMAIL PROTECTED] _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

