[fpc-devel] TComponent has no Loading() method

Michael Van Canneyt michael at freepascal.org
Mon Dec 10 11:15:54 CET 2007



On Mon, 10 Dec 2007, Graeme Geldenhuys wrote:

> On 10/12/2007, Michael Van Canneyt <michael at freepascal.org> wrote:
> > > I don't use streaming in my GUI Forms Designer or applications, but
> > > need to setup the component to a know state!
> >
> > Sure, but this state cannot include csloading. Nothing is being loaded,
> > as you state yourself.
> 
> 
> Well, I'm doing the same as the streaming system, but not from a
> stream. Streaming populates the component properties to a set state
> without firing off events on those components.  I'm doing the exact
> same thing but without streaming! Yet I'm not allowed to us csLoading
> to get the same behaviour.
> 
> Simply because Borland implemented streaming to and from a .dfm file
> doesn't mean FPC must be limited to *only that functionality*.  I
> decided to take a different route in my Forms Designer by having the
> form designer write code in the .pas unit (instead of a external
> file), but still need other features from TComponent (beyond the
> streaming feature).
> 
> 
> > There is no need to expose Loading because there is 1 and only 1 moment
> > when loading must be set: during component streaming. And then it is set
> > by the streaming system.
> 
> Yeah, only applies if you follow Borland's external form files
> (.dfm's), but what if you have a Forms Designer that writes code
> inside your normal .pas unit. Visual Studio also does this. How am I
> supposed to setup a components properties and state without firing
> events while doing it. ComponentState is the most logical property to
> use, it's already there.
> 
> Again, making the change is *not* going to break any code, but does
> make TComponent more flexible for other not 'Borland clone'
> applications.

Yes, but it does mean you expose something which should not be exposed.

Ok, I'm not particularly in favour of doing this, but I will add a 
protected "Loading" method, non virtual.

Michael.



More information about the fpc-devel mailing list