[Lazarus] Custom composite components issue with latest Lazarus

classic Classic list List threaded Threaded
27 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Custom composite components issue with latest Lazarus

Graeme Geldenhuys
Hi,

tiOPF v2 has a few "unsupported" LCL components. They are basically
composite components (eg: a panel with other embedded components).
Before, the following code compiled without problems. A user reported
that it doesn't compile any more.

---8<-----------8<-----------8<-----------8<-----------8<-----------
  {$IFDEF FPC}
  Include(FLabel.ComponentStyle, csSubComponent);
  Include(FLabel.ControlStyle, csNoDesignSelectable);
  Include(FWinControl.ComponentStyle, csSubComponent);
  Include(FWinControl.ControlStyle, csNoDesignSelectable);
  {$ENDIF}
---8<-----------8<-----------8<-----------8<-----------8<-----------


There are two problems really.

1) Since recent FPC release, the Include() may not take a property as a
parameter. This is easily worked around, so not a problem.

2) ComponentStyle now seems to be a read-only property, where I guess
before it was read/write.  How am I supposed to fix this code now?
FComponentStyle is also Protected, so I can't access it normally, except
with the "friend class hack". Is the hack the only way? Why is
ComponentStyle now read-only, and why is there no SetComponentStyle
method as replacement?



On a side note:
If you don't know what the code above does... well, Lazarus form
designer has a loong time bug with composite components, treating each
component separately (sub component could even be deleted), where in
fact they were supposed to be treated as a single component. The code
above alleviated some of the Lazarus issues, but it was still very buggy.


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Martin Schreiber
On Tuesday, 1. February 2011 09.10:01 Graeme Geldenhuys wrote:

> Hi,
>
> tiOPF v2 has a few "unsupported" LCL components. They are basically
> composite components (eg: a panel with other embedded components).
> Before, the following code compiled without problems. A user reported
> that it doesn't compile any more.
>
> ---8<-----------8<-----------8<-----------8<-----------8<-----------
>   {$IFDEF FPC}
>   Include(FLabel.ComponentStyle, csSubComponent);
>   Include(FLabel.ControlStyle, csNoDesignSelectable);
>   Include(FWinControl.ComponentStyle, csSubComponent);
>   Include(FWinControl.ControlStyle, csNoDesignSelectable);
>   {$ENDIF}
> ---8<-----------8<-----------8<-----------8<-----------8<-----------
>
>
> There are two problems really.
>
> 1) Since recent FPC release, the Include() may not take a property as a
> parameter. This is easily worked around, so not a problem.
>
> 2) ComponentStyle now seems to be a read-only property, where I guess
> before it was read/write.  How am I supposed to fix this code now?
> FComponentStyle is also Protected, so I can't access it normally, except
> with the "friend class hack". Is the hack the only way? Why is
> ComponentStyle now read-only, and why is there no SetComponentStyle
> method as replacement?
>
Please use
"
    procedure SetSubComponent(ASubComponent: Boolean);
"

Martin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Paul Ishenin-2
In reply to this post by Graeme Geldenhuys
01.02.2011 15:10, Graeme Geldenhuys wrote:

> ---8<-----------8<-----------8<-----------8<-----------8<-----------
>    {$IFDEF FPC}
>    Include(FLabel.ComponentStyle, csSubComponent);
>    Include(FLabel.ControlStyle, csNoDesignSelectable);
>    Include(FWinControl.ComponentStyle, csSubComponent);
>    Include(FWinControl.ControlStyle, csNoDesignSelectable);
>    {$ENDIF}
> ---8<-----------8<-----------8<-----------8<-----------8<-----------
> 2) ComponentStyle now seems to be a read-only property, where I guess
> before it was read/write.  How am I supposed to fix this code now?
> FComponentStyle is also Protected, so I can't access it normally, except
> with the "friend class hack". Is the hack the only way? Why is
> ComponentStyle now read-only, and why is there no SetComponentStyle
> method as replacement?

Because not every component style should be controlled by user code.

Use FLabel.SetSubComponent(True)

Best regards,
Paul Ishenin


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Graeme Geldenhuys
In reply to this post by Martin Schreiber
Op 2011-02-01 10:19, Martin Schreiber het geskryf:
> Please use
> "
>     procedure SetSubComponent(ASubComponent: Boolean);
> "


Thanks, that worked!  Since when do you know such a lot about LCL? ;-)



Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Paul Ishenin-2
01.02.2011 15:25, Graeme Geldenhuys пишет:
> Thanks, that worked!  Since when do you know such a lot about LCL? ;-)

This is RTL

Best regards,
Paul Ishenin


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Martin Schreiber
In reply to this post by Graeme Geldenhuys
On Tuesday, 1. February 2011 09.25:13 Graeme Geldenhuys wrote:
> Op 2011-02-01 10:19, Martin Schreiber het geskryf:
> > Please use
> > "
> >     procedure SetSubComponent(ASubComponent: Boolean);
> > "
>
> Thanks, that worked!  Since when do you know such a lot about LCL? ;-)
>
It is Delphi compatible AFAIK. ;-)

Martin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Graeme Geldenhuys
Op 2011-02-01 10:31, Martin Schreiber het geskryf:
>>
> It is Delphi compatible AFAIK. ;-)

I should have guessed - that's the "default" answer to all my questions
here. :-)



Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Graeme Geldenhuys
In reply to this post by Paul Ishenin-2
Op 2011-02-01 10:26, Paul Ishenin het geskryf:
>
> This is RTL


OK, thanks for pointing it out. I don't dabble to much in TComponent and
other Delphi-like friends, so excuse my ignorance is this area. :)



Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Paul Ishenin-2
In reply to this post by Graeme Geldenhuys
01.02.2011 15:34, Graeme Geldenhuys wrote:

> I should have guessed - that's the "default" answer to all my questions
> here. :-)

If Lazarus and FPC will not be Delphi compatible they lose big amount of
current and potential users.

I would probably never join Lazarus and FPC project if I had big
problems with porting my component source code.

Best regards,
Paul Ishenin


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Michael Schnell
In reply to this post by Graeme Geldenhuys
Graeme,

While with the most recent Lazarus svn and fpGUI git sources I can
compile and my Event Test demo program for the Build Modes "gtk" and
"gtk 2", when switching the LCLWidgetType Macro to "fpGUI" I get:

"fpgui/corelib/fpg_base.pas(27,3) Fatal: Can't find unit fpg_impl used
by fpg_base"

Whats up ?

Thanks,
-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Mattias Gaertner
On Tue, 01 Feb 2011 11:29:26 +0100
Michael Schnell <[hidden email]> wrote:

> Graeme,
>
> While with the most recent Lazarus svn and fpGUI git sources I can
> compile and my Event Test demo program for the Build Modes "gtk" and
> "gtk 2", when switching the LCLWidgetType Macro to "fpGUI" I get:
>
> "fpgui/corelib/fpg_base.pas(27,3) Fatal: Can't find unit fpg_impl used
> by fpg_base"
>
> Whats up ?

The unit is here:
lcl/interfaces/fpgui/corelib/x11/fpg_impl.pas

If not, then take a look at the lazarus wiki page about fpgui.

Mattias


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Michael Schnell
On 02/01/2011 11:38 AM, Mattias Gaertner wrote:
>
> The unit is here:
> lcl/interfaces/fpgui/corelib/x11/fpg_impl.pas
>
> If not, then take a look at the lazarus wiki page about fpgui.
it did work but stopped to do so.

That is why I think, Graeme should know about it.

-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Graeme Geldenhuys
Op 2011-02-01 12:41, Michael Schnell het geskryf:
>> The unit is here:
>> lcl/interfaces/fpgui/corelib/x11/fpg_impl.pas
>>
>> If not, then take a look at the lazarus wiki page about fpgui.
> it did work but stopped to do so.
>
> That is why I think, Graeme should know about it.

No idea (if you say it worked before - when?). I have supplied any
patches to Lazarus to change search/unit paths for LCL-fpGUI. Neither
have I moved units around in fpGUI.


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Michael Schnell
In reply to this post by Mattias Gaertner
On 02/01/2011 11:38 AM, Mattias Gaertner wrote:
>
> The unit is here:
> lcl/interfaces/fpgui/corelib/x11/fpg_impl.pas
>
it is (as a symlink to the fpGUI git directory).

it very short :).

-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Graeme Geldenhuys
In reply to this post by Graeme Geldenhuys
Op 2011-02-01 12:43, Graeme Geldenhuys het geskryf:
>
> I have supplied any patches to Lazarus to....

Sorry, typo... That should read: "I haven't supplied any patches to
Lazarus to..."




Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Michael Schnell
In reply to this post by Graeme Geldenhuys
On 02/01/2011 11:43 AM, Graeme Geldenhuys wrote:
>
> No idea (if you say it worked before - when?).
Before the Widget Type selection had been moved into the "Build Mode" panel

-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Mattias Gaertner
On Tue, 01 Feb 2011 11:51:28 +0100
Michael Schnell <[hidden email]> wrote:

> On 02/01/2011 11:43 AM, Graeme Geldenhuys wrote:
> >
> > No idea (if you say it worked before - when?).
> Before the Widget Type selection had been moved into the "Build Mode" panel

It works here.
I set LCLWidgeType to fpgui, click ok, press F9, the fpgui
widgetset is compiled and I get a lcl/fpgui program.

Have you set other macros?

Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Michael Schnell
In reply to this post by Graeme Geldenhuys
On 02/01/2011 11:43 AM, Graeme Geldenhuys wrote:
> No idea (if you say it worked before - when?).

I suppose some search directory is not set correctly when I select fpGUI
as a Widget Type.

-Michael

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Michael Schnell
In reply to this post by Mattias Gaertner
On 02/01/2011 11:56 AM, Mattias Gaertner wrote:
>
> I set LCLWidgeType to fpgui, click ok, press F9,
That is exactly what I do.
> the fpgui
> widgetset is compiled and I get a lcl/fpgui program.
>
> Have you set other macros?
Yep. fpGUIPlatform is set to x11

I suppose this is necessary.

After deleting fpGUIPlatform it does work.

Now I again set fpGUIPlatform and it continues working.

Funny....

-Michael


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Custom composite components issue with latest Lazarus

Mattias Gaertner
On Tue, 01 Feb 2011 12:04:53 +0100
Michael Schnell <[hidden email]> wrote:

> On 02/01/2011 11:56 AM, Mattias Gaertner wrote:
> >
> > I set LCLWidgeType to fpgui, click ok, press F9,
> That is exactly what I do.
> > the fpgui
> > widgetset is compiled and I get a lcl/fpgui program.
> >
> > Have you set other macros?
> Yep. fpGUIPlatform is set to x11
>
> I suppose this is necessary.

No. If the macro is undefined the LCL will set a default.

 
> After deleting fpGUIPlatform it does work.
>
> Now I again set fpGUIPlatform and it continues working.
>
> Funny....

Maybe you set 'x11 '?

If it happens the next time, please check the search paths. (open
package lcl, compiler options, show options)

Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
12