[Lazarus] LCL improvement idea

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Jan 18 12:11:59 CET 2011



On Tue, 18 Jan 2011, Max Vlasov wrote:

> On Tue, Jan 18, 2011 at 11:25 AM, <michael.vancanneyt at wisa.be> wrote:
>
>>
>>
>> On Tue, 18 Jan 2011, Max Vlasov wrote:
>>
>>  On Mon, Jan 17, 2011 at 2:08 PM, Michael Van Canneyt <
>>> michael at freepascal.org
>>>
>>>> wrote:
>>>>
>>>
>>> ...
>>>>
>>>> Var
>>>>  LabelDefaults : TLabelDefaults;
>>>>
>>>> Which are applied as soon as a TLabel control is created.
>>>>
>>>>
>>> I liked the idea, but to understand it correctly... You placed it in
>>> "var",
>>> isn't it supposed to be placed on a form like any other TComponent? ...
>>>
>>
>> No, I actually meant a var, because I want it to be application-wide.
>>
>>
> Hmm, Michael, I understand you here, but I think that the main drawback
> about application-wide (so possibly run-time only) is about losing
> design-time magic. For example when you have 10 panels, go change some
> design-time property and they changed their view all at once without even
> running anything. If they're form-only and design-time, you still can
> imitate application-wide defaults inheriting from common ancestor and
> placing all you defaults there, but you will keep this magic at your fingers

The whole point is to avoid having to do the same task all over again.
Remember, a typical app of mine has more than 1000 forms.

If you set a property at design time, the 'default' is overridden anyway: 
- Default is applied at control creation. 
- When the control is loaded from stream, control-specific values are set,
   and override the defaults.

When you use 'per form' defaults, it becomes more difficult, because then
you must make sure that first the form defaults are loaded, and only then
read the properties. In that scenario, we must check the order of events: 
all 'defaultable' properties should be set only in the Loaded method, because 
only in the Loaded event we know whether there is a 'defaults' component.

So my scenario is more simple. But I think both can be implemented, they
don't disturb each other.

Michael.




More information about the Lazarus mailing list