Recent

Author Topic: fpGUI (or: I must be stupid)  (Read 7575 times)

Bart

  • Hero Member
  • *****
  • Posts: 3516
    • Bart en Mariska's Webstek
fpGUI (or: I must be stupid)
« on: October 26, 2016, 06:25:21 pm »
Using Lazarus trunk/fpc 3.0.0 32-bit on Windows 7

I wanted to try out fpGUI.
Got source (stable) form https://github.com/graemeg/fpgui/
I read http://wiki.lazarus.freepascal.org/fpGUI_Interface
I followed the steps at "Using Lazarus (trunk)"

In compiler options I set widgetset to fpGUI.
I hit Ctrl+F9 and got:
fpg_impl.pas(26,3) Fatal: Can't find unit x used by fpg_impl
where fpg_imp = C:\devel\lazarus\lcl\interfaces\fpgui\src\corelib\x11\fpg_impl.pas

That does not sound OK to me.
I set Target to win32, Processor to i386: no change.
I build lcl\interfaces\fpgui\src\corelib\gdi\fpgui_toolkit and add it as dependency to current project: no change.

Lazarus passes this to the compiler:
 -Twin32 -Pi386 -MObjFPC -Scghi -Cirot -O1 -gs -gl -gh -l -vewnhibq -Filib\i386-win32 -FuMijnLib -FuC:\devel\lazarus\components\synedit\units\i386-win32\fpgui -FuC:\devel\lazarus\components\lazcontrols\lib\i386-win32\fpgui -FuC:\devel\lazarus\lcl\units\i386-win32\fpgui -FuC:\devel\lazarus\lcl\units\i386-win32 -FuC:\devel\lazarus\components\lazutils\lib\i386-win32 -FuC:\devel\lazarus\lcl\interfaces\fpgui\lib\i386-win32 -FuC:\devel\lazarus\packager\units\i386-win32 -Fu. -FUlib\i386-win32 -dLCL -dLCLfpgui -FcUTF8

Obviously I do something wrong (which would imply that the cited wiki-page is not correct anymore)?

Bart

lainz

  • Hero Member
  • *****
  • Posts: 3219
    • Lainz
Re: fpGUI (or: I must be stupid)
« Reply #1 on: October 26, 2016, 08:20:24 pm »
Is just an idea but why you don't try trunk of fpgui, I've used it and works really well.

Bart

  • Hero Member
  • *****
  • Posts: 3516
    • Bart en Mariska's Webstek
Re: fpGUI (or: I must be stupid)
« Reply #2 on: October 26, 2016, 09:58:46 pm »
Done that: same result.
Actually I tried trunk first, then reverted to stable hoping the problem would go away.

Where is Graeme when you need him?

Bart

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: fpGUI (or: I must be stupid)
« Reply #3 on: October 28, 2016, 12:04:48 am »
I didn't check the wiki, but just did the following with Lazarus (trunk) and fpGUI ('maint' branch). As far as I know the LCL-fpGUI widgetset hasn't been updated yet to support fpGUI's 'develop' branch.

Lazarus IDE seems to frequently change its dialogs and setting locations, so many of the Wiki information goes out of date frequently, and the wiki doesn't support information per Lazarus IDE version. This is not just an issue with the fpGUI information, but any Lazarus IDE information.

Anyway, the steps to compile a LCL-fpGUI application:
  • Switch to the 'maint' branch in the cloned fpGUI repository
  • Start a new LCL application
  • Tell it to use LCL-fpGUI widgeset by using the Additions and Overrides dialog:
    • define IDE Macro: LCLWidgetType := fpgui
    • define IDE Macro: fpGUIPlatform := gdi
  • Compile your project

Step 3.2 is what you were missing, and it what sets some platform specific unit search paths.

I've attached screenshots of the Additions and Overrides dialog where to find the setting items.

Notes:
  • TLabel is not yet implement. It will cause an AV in your program at runtime.
  • Most of the components on the Standard palette have been implement, some from the Additional palette and various Dialogs and Win32 API calls (eg: ShowMessage)
  • I highly recommend using fpGUI directly - not via the LCL-fpGUI widgetset. That is the only way you will get the full benefit of what fpGUI offers. The fpGUI repository also contains Lazarus IDE add-on packages than register new Project Types to help you speed up the process of starting a new "pure" fpGUI Application - see the extras directory..
« Last Edit: October 28, 2016, 12:07:08 am by Graeme »
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Bart

  • Hero Member
  • *****
  • Posts: 3516
    • Bart en Mariska's Webstek
Re: fpGUI (or: I must be stupid)
« Reply #4 on: October 28, 2016, 06:38:11 pm »
Yes, it compiles now.
But it immediately sigsevs.

1 form
1 tedit
1 tbutton

Code: [Select]
C:\Users\Bart\LazarusProjecten>gdb test.exe
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Users\Bart\LazarusProjecten/test.exe...done.
(gdb) run
Starting program: C:\Users\Bart\LazarusProjecten/test.exe
[New Thread 4324.0x253c]
WARNING: TLazIntfImage.ChooseRawBitsProc Unsupported BitsPerPixel=0

Program received signal SIGSEGV, Segmentation fault.
0x005150c9 in TFPGGDIAPPLICATION__DOWAKEMAINTHREAD (SENDER=0x0,
    this=<error reading variable>) at ./fpgui/src/corelib/gdi/fpg_gdi.pas:1279
1279      Windows.PostMessage(TfpgGDIWindow(MainForm).WinHandle, WM_NULL, 0, 0);

(gdb) bt
#0  0x005150c9 in TFPGGDIAPPLICATION__DOWAKEMAINTHREAD (SENDER=0x0,
    this=<error reading variable>) at ./fpgui/src/corelib/gdi/fpg_gdi.pas:1279
#1  0x004238d8 in TAPPLICATION__QUEUEASYNCCALL (
    AMETHOD=0x419890 <TCUSTOMFORM__MOVED>, DATA=0,
    this=<error reading variable>) at ./include/application.inc:2260
#2  0x00419885 in TCUSTOMFORM__WMMOVE (MESSAGE=...,
    this=<error reading variable>) at ./include/customform.inc:729
#3  0x0040c2e8 in SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal ()
#4  0x005695dc in VMT_$FORMS_$$_TCUSTOMFORM ()
#5  0x00000012 in ?? ()
#6  0x00000003 in ?? ()
#7  0x0223fca0 in ?? ()
#8  0x004d4f61 in TWINCONTROL__WNDPROC (MESSAGE=...,
    this=<error reading variable>) at ./include/wincontrol.inc:5377
#9  0x0041ae9d in TCUSTOMFORM__WNDPROC (THEMESSAGE=...,
    this=<error reading variable>) at ./include/customform.inc:1456
#10 0x00537049 in DELIVERMESSAGE (TARGET=0x248a670, AMESSAGE=void)
    at lclmessageglue.pas:112
#11 0x00537206 in LCLSENDMOVEMSG (TARGET=0x248a670, XPOS=646, YPOS=101,
    MOVETYPE=0, FROMINTERFACE=false) at lclmessageglue.pas:296
#12 0x0050035c in TFPGUIPRIVATEWIDGET__SETPOSITION (AX=646, AY=101,
    this=<error reading variable>) at ./fpgui/fpguiwsprivate.pp:803
#13 0x00537b48 in TFPGUIWSWINCONTROL__SETBOUNDS (AWINCONTROL=0x248a670,
    ALEFT=646, ATOP=101, AWIDTH=624, AHEIGHT=493, pvmt=0x248b030)
    at ./fpgui/fpguiwscontrols.pp:206
#14 0x004d9e60 in TWINCONTROL__DOSENDBOUNDSTOINTERFACE (
    this=<error reading variable>) at ./include/wincontrol.inc:8410
#15 0x0041aeef in TCUSTOMFORM__DOSENDBOUNDSTOINTERFACE (
    this=<error reading variable>) at ./include/customform.inc:1471
#16 0x004d9f66 in TWINCONTROL__REALIZEBOUNDS (this=<error reading variable>)
    at ./include/wincontrol.inc:8461
#17 0x004da204 in TWINCONTROL__REALIZEBOUNDSRECURSIVE (
    this=<error reading variable>) at ./include/wincontrol.inc:8499
#18 0x004d1e3a in TWINCONTROL__DOALLAUTOSIZE (this=<error reading variable>)
    at ./include/wincontrol.inc:3533
#19 0x004e40da in TCONTROL__ENABLEAUTOSIZING (this=<error reading variable>)
    at ./include/control.inc:5451
#20 0x004e25d0 in TCONTROL__SETVISIBLE (VALUE=true,
    this=<error reading variable>) at ./include/control.inc:4287
#21 0x004192e6 in TCUSTOMFORM__SETVISIBLE (VALUE=true,
    this=<error reading variable>) at ./include/customform.inc:488
#22 0x0041cc07 in TCUSTOMFORM__SHOW (this=<error reading variable>)
    at ./include/customform.inc:2243
#23 0x004227ed in TAPPLICATION__RUN (this=<error reading variable>)
    at ./include/application.inc:1390
#24 0x00401e6a in main () at test.lpr:19

Bart
« Last Edit: October 28, 2016, 11:45:30 pm by Bart »

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: fpGUI (or: I must be stupid)
« Reply #5 on: October 28, 2016, 07:37:00 pm »
Interesting, I tested here under 64-bit FreeBSD and 64-bit Windows 7. Both using FPC 2.6.4 and latest Lazarus LCL (trunk). I used a wide variety of widgets as can be seen in the screenshots attached.

Either way, I'll take a look at your backtrace information and see if I can find something odd in the LCL.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: fpGUI (or: I must be stupid)
« Reply #6 on: October 28, 2016, 11:31:16 pm »
Yes, it compiles now.
But it immediately sigsevs.
OK, I did find an intermittent issue and resolved it with fpGUI commit dbf24a2. Please get a fpGUI 'maint' branch update and try again.

Note:
You will have to recompile LCL for the change to take effect. In my test application, I had to manually open the LCL package and click "Compile", as Lazarus does not detect fpGUI source code changes.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Bart

  • Hero Member
  • *****
  • Posts: 3516
    • Bart en Mariska's Webstek
Re: fpGUI (or: I must be stupid)
« Reply #7 on: October 28, 2016, 11:52:26 pm »
I highly recommend using fpGUI directly - not via the LCL-fpGUI widgetset. That is the only way you will get the full benefit of what fpGUI offers.

And what to use as visual form designer then?
Any link to a tutorial?

I just wanted to play around a little, just to see what it is and wether I like it or not.
So, I took the lazy way.

B.t.w. I don't have a git client, I used the webinterface (one of the wiki links) and downloaded the zip file.
Needless to say I'm an ignorant w.r.t. git.

Bart

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: fpGUI (or: I must be stupid)
« Reply #8 on: October 29, 2016, 12:22:22 am »
And what to use as visual form designer then?
fpGUI includes everything you need as stand-alone tools. That way you can use any IDE (Lazarus, MSEgui, Geany, Delphi etc) or Programmer Editor to integrate the various fpGUI toolkits via the development environment's "External Tools" functionality.

fpGUI has its own Visual Forms Designer called UI Designer and is located in the <fpgui>/uidesigner/ directory. Simply Open the the project with Lazarus IDE and compile it. If Lazarus complains that in can't find the fpgui_toolkit.lpk package, then simply select "Package -> Open package file (.lpk)" and select the fpgui_toolkit.lpk package found in the <fpgui>/src/corelib/gdi/ directory.

This page on the fpGUI website has a screenshot of the UI Designer. It's an couple years old version, but it gives you an idea at least.
http://fpgui.sourceforge.net/screenshots_apps.shtml
That page also has a screenshot of fpGUI help viewer - DocView.

To integrate fpGUI's UIDesigner with Lazarus IDE, use the External Tools functionality of Lazarus. The steps is near identical to how you integrate fpGUI's DocView (help viewer) into Lazarus. Good news is, there is no need to recompile Lazarus IDE for any of this.

  http://fpgui.sourceforge.net/docview_ide_integration.shtml

I've attached a screenshot of how I integrated UIDesigner with my Lazarus. I highlighted the important parts. Note: You can choose any keyboard shortcut that suits you.

Quote
Any link to a tutorial?
The <fpgui>/docs/INSTALL.txt file explains many different ways of installing a fpGUI development environment - depending on what development environment you are using (Lazarus IDE, MSEide, Free Pascal's Text IDE etc).

The FPC Wiki also has some details:  http://wiki.freepascal.org/fpGUI

I'm also busy writing a "A Quick Guide to using fpGUI Toolkit" book. I've got a few chapters done already. The book source (IPF file) can be found in the <fpgui>/docs/quick_guide/ directory and can be compiled with WIPFC into a binary INF file, which in turn can be viewed with DocView (found in <fpgui>/docview/ directory).

Quote
I just wanted to play around a little, just to see what it is and wether I like it or not.
So, I took the lazy way.
Unfortunately you chose the worst way to experience fpGUI. The LCL-fpGUI widgetset is missing many of the benefits of fpGUI, plus it has a lot less widgets than the "pure" fpGUI Toolkit includes.

Quote
B.t.w. I don't have a git client, I used the webinterface (one of the wiki links) and downloaded the zip file.
Needless to say I'm an ignorant w.r.t. git.
I highly recommend you install Git. More and more projects are using Git now, and even the console client (which I recommend) is very easy to use.  https://git-scm.com/downloads
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: fpGUI (or: I must be stupid)
« Reply #9 on: October 29, 2016, 12:56:30 am »
...which would imply that the cited wiki-page is not correct anymore
For future reference I have just updated the LCL-fpGUI Interface wiki page with up-to-date instructions.

http://wiki.lazarus.freepascal.org/fpGUI_Interface#Creating_your_first_LCL_application_with_fpGUI
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/