[Lazarus] What GetChildParent does in designer and reader?

luiz americo pereira camara luizmed at oi.com.br
Wed Mar 5 01:22:32 CET 2014


Hi Fabio,

I'd like to share how i  implemented similar behavior of TDbCtrlGrid, so
maybe you can be interested. If not just ignore.

First i create a TFrame in Lazarus put the controls that i need to be there.

In the control i want to display the instances of the frame i create at
runtime according to a configuration

This way i have the easy of use of Lazarus designer with a lot of
flexibility.

I created an control (
https://code.google.com/p/luipack/source/browse/trunk/luicontrols/jsonmediators.pas)
that does the above. The frame class
(TJSONBooleanRadioButtonViewFrame)
is hardcoded but it can be decoupled by using an interface.

To implement TDbCtrlGrid like control with this approach seems easier then
you are trying:

- Define an interface with what you need to configure the DbCtrls like
  IDbCtrlItem = interface
  SetDatasource(Datasource: TDataSource);
  end;
- Create a control that has a TFrameClass property
- When the TFrameClass is set, check if implements IDbCtrlItem
- At runtime create as many TFrameClass instances as needed configuring
them at initialization through the IDbCtrlItem interface
- Bind to dataset events and update the controls accordingly

Luiz


2014-03-04 10:41 GMT-03:00 Fabio Luis Girardi <fluisgirardi at gmail.com>:

> Hi Mattias!!
>
> This solution don't work too.
>
>
> 2014-03-04 9:46 GMT-03:00 Fabio Luis Girardi <fluisgirardi at gmail.com>:
>
> Maybe RemoveHandlerAddClicked is a replacement?
>>
>>
>> 2014-03-04 9:43 GMT-03:00 Fabio Luis Girardi <fluisgirardi at gmail.com>:
>>
>> mytesthelper.pas(40,20) Error: identifier idents no member
>>> "RemoveHandlerComponentAdded"
>>>
>>> Lazarus 1.3
>>>
>>>
>>>
>>> 2014-03-03 18:56 GMT-03:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:
>>>
>>> On Mon, 3 Mar 2014 16:47:30 -0300
>>>> Fabio Luis Girardi <fluisgirardi at gmail.com> wrote:
>>>>
>>>> > Hi!!
>>>> >
>>>> > Attached the code of my prototype of TDBCtrlGrid. It works as
>>>> expected on
>>>> > Delphi (except the function GetDesignerDropTarget that don't exists on
>>>> > Delphi TWinControl), but it don't works as expected on Lazarus.
>>>>
>>>> On second thought the LCL method is not very flexible.
>>>> I added a general designer event.
>>>>
>>>> See
>>>>
>>>> http://wiki.lazarus.freepascal.org/Extending_the_IDE#Example:_When_dropping_a_new_component_move_control_to_a_child
>>>>
>>>> Please test.
>>>>
>>>> Mattias
>>>>
>>>> --
>>>> _______________________________________________
>>>> Lazarus mailing list
>>>> Lazarus at lists.lazarus.freepascal.org
>>>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>>>
>>>
>>>
>>>
>>> --
>>> The best regards,
>>>
>>> Fabio Luis Girardi
>>> PascalSCADA Project
>>> http://sourceforge.net/projects/pascalscada
>>> http://www.pascalscada.com
>>>
>>
>>
>>
>> --
>> The best regards,
>>
>> Fabio Luis Girardi
>> PascalSCADA Project
>> http://sourceforge.net/projects/pascalscada
>> http://www.pascalscada.com
>>
>
>
>
> --
> The best regards,
>
> Fabio Luis Girardi
> PascalSCADA Project
> http://sourceforge.net/projects/pascalscada
> http://www.pascalscada.com
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140304/d996bc97/attachment-0003.html>


More information about the Lazarus mailing list