Just like we have the following methods to manage csUpdating in ComponentState procedure…
Graeme Geldenhuys wrote 16 lines
You're not supposed to set loading. Loading should only be set when reading components from stream.
Michael.

Mailing lists / fpc-devel / 2007-12
11 messages · 3 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Just like we have the following methods to manage csUpdating in ComponentState procedure…
You're not supposed to set loading. Loading should only be set when reading components from stream.
Michael.
Hi,
Just like we have the following methods to manage csUpdating in ComponentState
procedure Updating; dynamic;
procedure Updated; dynamic;we only have Loaded() in TComponent (excluding csLoading). Can't we have a Loading() method as well so we can insert csLoading in ComponentState?
I need to 'include' csLoading in the ComponentState in a descendant TComponent class, but apparently it's not possible because FComponentState is private and the ComponentState property is Read-Only.
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
You're not supposed to set loading. Loading should only be set when reading components…
Michael Van Canneyt wroteYou're not supposed to set loading. Loading should only be set when reading components from stream.
Why not?
I don't use streaming in my GUI Forms Designer or applications, but need to setup the component to a know state! Yes, I can create my own property, but I don't see the point, when I am going to mimic ComponentState exactly, so why can't I use ComponentState.
After all - what I want to do is set and check the component's state to make sure certain events don't fire while I populate the component or work in the Forms Designer. Same thing gets done with csUpdating and csDesigning and yet I have access to the later (via Updating, Updated and SetDesigning). Why not Loading? We already have Loaded? Such a change would also not break any existing code, but would make TComponent more flexible.
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Sure, but this state cannot include csloading. Nothing is being loaded, as you state yourself.
Loaded is exposed because you must be able to perform certain actions when you know that all properties are loaded. (fix up references etc, open up connections and whatnot). You are not allowed to call loaded in user code. (Delphi's help is very explicit about this, BTW)
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.
Michael.
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.
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
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.
Michael Van Canneyt wroteYes, but it does mean you expose something which should not be exposed.
That's what 'Protected' is for. The average Joe 'user' would not be able to see that code - only framework/component developers will, and they are supposed to be of higher intelligence. ;-)
Ok, I'm not particularly in favour of doing this, but I will add a protected "Loading" method, non virtual.
That would be perfect, thanks!
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Just like we have the following methods to manage csUpdating in ComponentState procedure…
Graeme Geldenhuys wroteI need to 'include' csLoading in the ComponentState in a descendant TComponent class, but apparently it's not possible because FComponentState is private and the ComponentState property is Read-Only.
Why not put FComponentState in protected area ?
Micha
Yes, but it does mean you expose something which should not be exposed. Ok, I'm not…
Hi Michael,
What ever happened to this? I've just searched the TComponent class in FPC 2.3.1 and can't find any Loading method you said you would add.
I was busy adding FPC version specific defines in fpGUI and thought I would make it compilable with FPC 2.3.1, but need the Loading function first.
Regards,
- Graeme -
Graeme Geldenhuys wroteHi Michael, What ever happened to this? I've just searched the TComponent class in FPC 2.3.1 and can't find any Loading method you said you would add.
I think you didn't search very well:
classesh.inc:1469: procedure Loading; virtual;From log:
r10094 | michael | 2008-01-29 13:31:24 +0100 (Tue, 29 Jan 2008) | 1 line
* Implemented Loading, as per Graeme Geldenhuys request
Michael.
My searching skills has gone out the window today! My apologies Michael. I had a very outdated (r9893) revision of FPC 2.3.1. I just got a update and it's there. :-) Thanks!
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/