Recent

Author Topic: LCL with fpGUI on Linux  (Read 603 times)

rsz

  • New Member
  • *
  • Posts: 13
LCL with fpGUI on Linux
« on: June 19, 2019, 05:17:13 pm »
Hi. I'm trying to get LCL with fpGUI working on Linux (Ubuntu 19.04) but I have run into an issue that I don't know how to solve.

I followed the guide over at:
https://wiki.lazarus.freepascal.org/fpGUI_Interface#Creating_your_first_LCL_application_with_fpGUI

I have selected option 2 (symlinking) at step 4.1 and did the following:
Code: [Select]
cd /usr/lib/lazarus/default/lcl/interfaces/fpgui
sudo ln -s /home/rsz/fpgui/src src

I then created an application project in Lazarus and added IDE macros: LCLWidgetType:=fpgui and fpGUIPlatform:=x11

Unfortunately I get the following error message when I build it:
Code: [Select]
project1.lpr(9,3) Fatal: Cannot find Interfaces used by project1. Enable flag "Use Unit" of unit Interfaces in package LCL.
Any ideas?

Thaddy

  • Hero Member
  • *****
  • Posts: 9152
Re: LCL with fpGUI on Linux
« Reply #1 on: June 19, 2019, 05:45:21 pm »
yes. LCL is a framework and FPGui is a different framework. Don't mix them..... BASIC
Although both frameworks supports all of the FPC packages available for a flatform. (So not Lazarus!!!!! only Lazarus supports LCL)
« Last Edit: June 19, 2019, 05:50:53 pm by Thaddy »
also related to equus asinus.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7495
Re: LCL with fpGUI on Linux
« Reply #2 on: June 19, 2019, 05:53:33 pm »
Thaddy, there is a "fpgui" backend for LCL. Just like GTK.

rsz: ignore Thaddy, what is wrong I don't know, but make sure you set the lcl backend over the GUI controls. Otherwise you risk that Lazarus adds the same macros as you do too.

Things to check:
- disable message filters, increase verbosity and try to find out what exactly goes wrong.
- see if you can see the commandline somewhere, to check if multiple lcl types are passed.

Thaddy

  • Hero Member
  • *****
  • Posts: 9152
Re: LCL with fpGUI on Linux
« Reply #3 on: June 19, 2019, 05:57:51 pm »
I did not know there was an fpgui back-end, but stll you can not mix the two, Marco......
You can not use LCL controls in an fpgui application. Period. Same with KOL..

I think that's where the confusion is about, I may be wrong...(I don't think so....)
« Last Edit: June 19, 2019, 05:59:33 pm by Thaddy »
also related to equus asinus.

rsz

  • New Member
  • *
  • Posts: 13
Re: LCL with fpGUI on Linux
« Reply #4 on: June 19, 2019, 08:55:38 pm »
I'm still not sure why the initial error (interface not found) message occurs with Lazarus installed through apt, but I have tried compiling Lazarus from source and have gotten a bit further.
It now no longer complains that it can't find the fpGUI interface, but it now complains about the fpGUI code itself. It seems to be missing the 'Graph' Unit.

Just out of curiosity I removed Graph from the source file and the compilation got further and I found the following afterwards that also mentions removing Graph:
http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-fpGUI-WS-update-td4053988.html

It's now stuck on:
Code: [Select]
fpguiwsbuttons.pp(88,60) Error: Wrong number of parameters specified for call to "GetImageIndexAndEffect"in the following procedure (line 15):
Code: Pascal  [Select]
  1. class procedure TFpGuiWSBitBtn.SetGlyph(const ABitBtn: TCustomBitBtn;
  2.   const AValue: TButtonGlyph);
  3. var
  4.   lButton: TFPGUIPrivateButton;
  5.   lBitmap: TBitmap=nil;
  6.   fpgImage: TfpgImage;
  7.   lButImageName: string;
  8.   lButtonState: TButtonState;
  9.   lIndex: integer;
  10.   lEffect: TGraphicsDrawEffect;
  11. begin
  12.   if not Assigned(AValue.Images) then exit;
  13.   lButton := TFPGUIPrivateButton(ABitBtn.Handle);
  14.   lButtonState:=bsUp;
  15.   Value.GetImageIndexAndEffect(lButtonState,lIndex,lEffect)
  16.   lBitmap:=TBitmap.Create;
  17.   AValue.Images.GetBitmap(lIndex,lBitmap);
  18.   fpgImage:=TfpgImage.Create;
  19.  
  20.   fpgImage.AllocateImage(32,lBitmap.Width,lBitmap.Height);
  21.   move(lBitmap.RawImage.Data^,fpgImage.ImageData^,fpgImage.ImageDataSize);
  22.  
  23.   fpgImage.CreateMaskFromSample(0,0);
  24.   fpgImage.UpdateImage;
  25.   lBitmap.Free;
  26.   if lButton.Button.ImageName<>'' then begin
  27.     fpgImages.DeleteImage(lButton.Button.ImageName,true);
  28.   end;
  29.   lButImageName:='lcl.bitbtn.'+IntToStr(PtrInt(ABitBtn.Handle));
  30.   fpgImages.AddImage(lButImageName,fpgImage);
  31.   lButton.Button.ImageName:=lButImageName;
  32.   lButton.Button.ShowImage:=true;
  33. end;

Is it possible that the fpGUI isn't updated to work with the latest LCL version? or what is the status of fpGUI as LCL backend?

I did not know there was an fpgui back-end, but stll you can not mix the two, Marco......
You can not use LCL controls in an fpgui application. Period. Same with KOL..

I think that's where the confusion is about, I may be wrong...(I don't think so....)
I am not trying to use LCL controls in an fpGUI application and neither am I trying to use fpGUI controls in an LCL application.
I'm trying to use pure LCL and change the backend to be fpGUI, just like you can change the backend to be Qt instead of Gtk+ on Linux.
I believe "interface" (as opposed to backend) is the proper terminology for it, but I'm new to Lazarus. There also is an option to select fpGUI as LCLWidgetType in Lazarus, so I assume it must be possible.
« Last Edit: June 19, 2019, 09:13:36 pm by rsz »

Zoran

  • Hero Member
  • *****
  • Posts: 1461
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: LCL with fpGUI on Linux
« Reply #5 on: June 19, 2019, 10:31:49 pm »
The LCL-fpGUI interface started many years ago, but never got very far.

See here: https://wiki.lazarus.freepascal.org/Roadmap#Widgetset_dependent_components

When I started using Lazarus, ten years ago, its state looked pretty much same.
So, it seems abandoned.

See this post from Graeme, five years ago: https://forum.lazarus.freepascal.org/index.php/topic,25530.msg155422.html#msg155422
(the controls from the Standard tab of Component palette work, except TLabel) -- so, its far from usable for a serious application.
I don't think that things changed since then.

On the other hand, fpGui itself, used without LCL, is fully working. It seems that Graeme was never interested in LCL-fpGUI development, (see also the bottom of this post: https://forum.lazarus.freepascal.org/index.php/topic,31971.msg205651.html#msg205651).

After LCL-fpGui, there was another effort to make pure Pascal (independent of external GUI libraries) LCL backend -- it was Custom Drawn Interface, but, after a while, it also looks abandoned.

So, either go for fpGui, as a standalone GUI library (without LCL), or choose LCL with "native" OS widgetsets.

Or... take the third way, you take over LCL-fpGui development and bring it to life! ;)


rsz

  • New Member
  • *
  • Posts: 13
Re: LCL with fpGUI on Linux
« Reply #6 on: June 20, 2019, 12:10:48 am »
Ah it's unfortunate that fpGUI and the custom drawn interface have never been finished. I was mainly interested in fpGUI due to it using X11 directly and therefore being a lot more lightweight than Gtk+ or Qt. Using a more lightweight backend would be very advantageous on RAM constrained systems.

LCL is pretty awesome and I wouldn't want to use fpGUI directly, as I then am unable to compile using the other LCL backends (present and future).

Or... take the third way, you take over LCL-fpGui development and bring it to life! ;)
If I decide to write my future programs using Lazarus then I would be inclined to do so (fpGUI or Custom Drawn Interface), as my only other option would be writing my own memory efficient toolkit ;).

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3645
  • I like bugs.
Re: LCL with fpGUI on Linux
« Reply #7 on: June 20, 2019, 08:17:58 am »
When I started using Lazarus, ten years ago, its state looked pretty much same.
So, it seems abandoned.

See this post from Graeme, five years ago: https://forum.lazarus.freepascal.org/index.php/topic,25530.msg155422.html#msg155422
(the controls from the Standard tab of Component palette work, except TLabel) -- so, its far from usable for a serious application.
I don't think that things changed since then.
In fact it was improved just last month in revisions 61119 - 61128. Patches came from Graeme himself.
It means users of LCL-fpGUI should use Lazarus trunk (development version).

Quote
Or... take the third way, you take over LCL-fpGui development and bring it to life! ;)
+1
Good idea.