Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-02

Custom composite components issue with latest Lazarus

27 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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/

Reply by email

Martin Schreiber
to Graeme Geldenhuys
Graeme Geldenhuys wrote 29 lines
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

Reply by email

Paul Ishenin
to Graeme Geldenhuys: tiOPF v2 has a few "unsupported" LCL components. They are basically composite components…
Graeme Geldenhuys wrote 14 lines
---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

Reply by email

Paul Ishenin
to Graeme Geldenhuys: Op 2011-02-01 10:31, Martin Schreiber het geskryf: I should have guessed - that's the…
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

Reply by email

Mattias Gaertner
to Michael Schnell
Show quoted text 10 lines
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

Reply by email

Michael Schnell
to Mattias Gaertner
Mattias Gaertner wrote 5 lines
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

Reply by email

Graeme Geldenhuys
to Michael Schnell

Op 2011-02-01 12:41, Michael Schnell het geskryf:

Show quoted text 7 lines
> 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/

Reply by email

Mattias Gaertner
to Michael Schnell
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

Reply by email

Michael Schnell
to Mattias Gaertner: On Tue, 01 Feb 2011 11:51:28 +0100 It works here. I set LCLWidgeType to fpgui, click ok,…
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

Reply by email

Mattias Gaertner
to Michael Schnell
Show quoted text 11 lines
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.

Show quoted text 5 lines
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

Reply by email

Michael Schnell
to Mattias Gaertner
Mattias Gaertner wrote
Maybe you set 'x11 '?

I did not touch this setting before it stopped working. Moreover I never typed in the text but selected it from the list. So I obviously was hit by some kind of glitch during the transition of the LCL packet makeup.

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

OK,
Thanks,
-Michael

Reply by email

Eduard Filipas
to Graeme Geldenhuys: Op 2011-02-01 12:41, Michael Schnell het geskryf: No idea (if you say it worked before -…

hi im newbi to lazarus

here a quick resume what i did ...
i downloaded .28 with fpc 224 from sourceforge
instaled tortuiseSVN and downloaded fixes 30
downloaded FPC 2.4.2
changed enviroment setings

but when i try to rebuild i get error in file \lcl\lresourses in
procedure TUTF8Parser.HandleString;

error says got ansistring expected Char..

i know i can get by with Char(pchar()) i just dont know if anybody else got the error and if the problem is somewhere else..

i use win7 64x
lazarus 32bit

best regards..

Reply by email

Mattias Gaertner
to Eduard Filipas
Show quoted text 6 lines
hi im newbi to lazarus here a quick resume what i did ... i downloaded .28 with fpc 224 from sourceforge instaled tortuiseSVN and downloaded fixes 30 downloaded FPC 2.4.2

2.2.4 or 2.4.2?

You need 2.4.2.

Show quoted text 6 lines
changed enviroment setings but when i try to rebuild i get error in file \lcl\lresourses in procedure TUTF8Parser.HandleString; error says got ansistring expected Char..

At least the developer version compiles with 2.4.2. I didn't test the fixes version.

Show quoted text 5 lines
i know i can get by with Char(pchar()) i just dont know if anybody else got the error and if the problem is somewhere else.. i use win7 64x lazarus 32bit

Mattias

Reply by email

Eduard Filipas
to Mattias Gaertner

hi Matias i'm haveing problem i cant recompile lazarus with a FPC 2.4.2.. same problem happened when i tried to use FPC 2.4.2 with lazarus .28 I would like to start using Lazarus but now i dont know where to start.. the downloaded version of lazarus that comes with FPC 2.2.4 i tried to alter it to FPC 2.4.2
there are some database issues in previus versions so i tried to update FPC when i change dir paths of enviroment to newest FPC theres all this nagging from ide that path is not correct and that files cannot be found but they are there..basicaly i just installed FPC 2.4.2 to C:\lazarus\fpc\2.4.2 and change paths from 2.2.4 to 2.4.2 compile starts but then lcl is giveing me problems.. it compiles fine with 2.2.4.

Regards

S, Mattias Gaertner pi?e:

Show quoted text 37 lines
On Thu, 03 Feb 2011 10:54:23 +0100 Eduard Filipas wrote: > hi im newbi to lazarus > > here a quick resume what i did ... > i downloaded .28 with fpc 224 from sourceforge > instaled tortuiseSVN and downloaded fixes 30 > downloaded FPC 2.4.2 2.2.4 or 2.4.2? You need 2.4.2. > changed enviroment setings > > but when i try to rebuild i get error in file \lcl\lresourses in > procedure TUTF8Parser.HandleString; > > error says got ansistring expected Char.. At least the developer version compiles with 2.4.2. I didn't test the fixes version. > i know i can get by with Char(pchar()) i just dont know if anybody > else got the error and if the problem is somewhere else.. > > i use win7 64x > lazarus 32bit Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Mattias Gaertner
to Eduard Filipas
hi Matias i'm haveing problem i cant recompile lazarus with a FPC 2.4.2.. same problem happened when i tried to use FPC 2.4.2 with lazarus .28

Lazarus 28 was for 2.2.4.

Show quoted text 10 lines
I would like to start using Lazarus but now i dont know where to start.. the downloaded version of lazarus that comes with FPC 2.2.4 i tried to alter it to FPC 2.4.2 there are some database issues in previus versions so i tried to update FPC when i change dir paths of enviroment to newest FPC theres all this nagging from ide that path is not correct and that files cannot be found but they are there..basicaly i just installed FPC 2.4.2 to C:\lazarus\fpc\2.4.2 and change paths from 2.2.4 to 2.4.2 compile starts but then lcl is giveing me problems.. it compiles fine with 2.2.4.

Have you tried to install the daily snapshot?

Mattias

Reply by email

Eduard Filipas
to Mattias Gaertner

nop havent yet tried daily snapshot ...i will try.

regards
Eduard

S, Mattias Gaertner pi?e:

Show quoted text 28 lines
On Thu, 03 Feb 2011 19:15:13 +0100 Eduard Filipas wrote: > hi Matias i'm haveing problem i cant recompile lazarus with a FPC 2.4.2.. > same problem happened when i tried to use FPC 2.4.2 with lazarus .28 Lazarus 28 was for 2.2.4. > I would like to start using Lazarus but now i dont know where to start.. > the downloaded version of lazarus that comes with FPC 2.2.4 > i tried to alter it to FPC 2.4.2 > there are some database issues in previus versions so i tried to update FPC > when i change dir paths of enviroment to newest FPC theres all this > nagging from ide that path is not correct and that files cannot be found > but they are there..basicaly i just installed FPC 2.4.2 to > C:\lazarus\fpc\2.4.2 and change paths from 2.2.4 to 2.4.2 > compile starts but then lcl is giveing me problems.. > it compiles fine with 2.2.4. Have you tried to install the daily snapshot? Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Michael Schnell
to Mattias Gaertner: On Tue, 01 Feb 2011 12:04:53 +0100 No. If the macro is undefined the LCL will set a…

Lust to let you and Graeme know:

It happened again after I died a "make clean all" on Lazarus.

fpGUIPlatform was set to X11

Deleting the fpGUIPlatform again solved it: the fpGUI LCL packed got recompiled.

Now again setting fpGUIPlatform to X11 again:The fpGUI LCL was recompiled again. No error message.

Something in the build process seems to be not perfect yet.

-Michael

Reply by email