[Lazarus] LCL improvement idea

Max Vlasov max.vlasov at gmail.com
Tue Jan 18 13:40:40 CET 2011


On Tue, Jan 18, 2011 at 2:11 PM, <michael.vancanneyt at wisa.be> wrote:

>
>
>  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.
>
>

Ok, now I see, your initial idea is really simple and working, the one I
suggested maybe needs a little more thinking about worth it or not
implementing. I know it can work, but for the time being looks a little bit
too complex

For yours I have something in mind. Is it possible to create something
similar to TApplicationEvents (in terms of accessing special places in the
LCL) and this component that will introduce an event

TOnCreateComponent: procedure (Sender: TObject; Component: TComponent) of
object;

if it's dropped on a form, it can control the place where actual
TComponentClass.Create fired and sends this event. In this case anyone can
easily do something like:

procedure TForm1.LCLEventsCreateComponent(Sender: TObject; Component:
TComponent);
begin
  if Component is TLabel then
    with Component as TLabel do
    begin
       AutoSize:=False;
       Layout:=tlCenter;
    end else
   if Component is ...
end;

This method should do exactly the things you described. Although it is a
form method, it doesn't matter much, it just should be first form to create
and never-freed. In this case it should work for any form (like
TApplicationEvents does).

Max Vlasov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110118/d36d9ed1/attachment-0003.html>


More information about the Lazarus mailing list