[fpc-pascal] FPGUI on Windows
James Richters
james.richters at productionautomation.net
Sat Nov 30 22:36:40 CET 2024
I decided to try to fix this myself, and I'm happy to say I got it working!
I finally figured out that the error message itself told me how to fix the
error in fpg_oledragdrop.pas:
Error: No matching implementation for interface method "SetData(const
tagFORMATETC;var TagSTGMEDIUM;LongBool):LongInt; StdCall;" found
It was telling me that the constant medium should be a variable:
function SetData(const formatetc: TFormatEtc; var medium: TStgMedium;
fRelease: bool): HResult; stdcall;
I also found that in fpg_base.pas the line:
TfpgChar = type String[4];
While this does work in FPC3.2.2, it Just doesn't work in the current FPC
trunk, so I changed it to
TfpgChar = String[4];
I thought it was more important to keep it a String[4] than to create a
special type for it... I'm not sure exactly when FPC changed that causes
this to be an issue, or if there is a better way to fix it, but for the
current trunk it needs to be addressed.
I then went on to figure out that X11 is a Linux thing, but I'm on Windows.
I was trying to compile fpGUI with the Text IDE... on Windows, and since I
was following the instructions for compiling with the IDE, which are not
valid at all for Windows, there is no way it could work. I knew to reverse
all the / to \ but I didn't know X11 was for Linux and I should be using GDI
for windows... why would I know that? Since I don't have linux, I have no
idea what the designation X11 is, and I really didn't even know GDI was an
option because it doesn't tell me to use it in the instructions. Well I
asked ChatGPT and it knew right away that X11 was not for Windows, and
that's the only reason I know it now.
I figured out that what I should be compiling with the IDE to build the All
the Units needed for fpGUI is fpgui_toolkit.pas, from either the GDI
directory for Windows, or the X11 directory for Linux, and I have no idea
what to do for Mac. Well the instructions don't make any of this clear at
all, and if you try to compile fpgui_toolkit.pas with the text IDE, you need
to put a LOT more directories in the units than what is indicated in the
instructions. I needed:
fpGUI\src
fpGUI\src\corelib
fpGUI\src\corelib\GDI
fpGUI\src\GUI
fpGUI\src\gui\db
fpGUI\src\reportengine
fpGUI\src\3rdparty\regex
I finally did get it to compile on both 3.2.2 and the current trunk and I
got build.bat to work as well, so I thought I would contribute my findings
to make it easier for others, as it took me 3 days to get this figured out.
So I found the fpGUI repo and noticed it had a develop branch, so I figured
that's where I should make pull requests... so I cloned the repo and had a
look and I noticed that the issue with setdata had already been fixed!
It has this code in it:
{$IF FPC_FULLVERSION >= 30200}
function SetData(const formatetc: TFormatEtc; var medium: TStgMedium;
fRelease: bool): HResult; stdcall;
{$ELSE}
function SetData(const formatetc: TFormatEtc; const medium:
TStgMedium; fRelease: bool): HResult; stdcall;
{$ENDIF}
So apparently this has been an issue since v3.0.2 but I was trying to
compile it with 3.2.2, which is > 3.0.2, and is the latest stable release of
FPC.
I didn't even think to go try the develop branch from the repository on
GitHub because I figured I would use the stable release of fpGUI on
SourceForge and when I couldn't get that to work, I assumed I was doing
something wrong... it was the stable release after all, and I was trying it
with the latest stable release of FreePascal: 3.2.2 It never occurred to me
that what is on Sorceforge would only good for versions of FreePascal Less
than 3.0.2
This one change should have been pushed through and released on Source Forge
the moment it was fixed, but surely when FPC 3.0.2 was released in 2017,
because the this error has been preventing build from working since and
including FPC 3.0.2
I made a pull request on GitHub and I hope SourceForge can be updated with
this one change. It would be nice to see a new version released with all
the many changes that are on the Develop branch, but I can understand how
the develop branch might not have been tested enough to justify a new
release. But fixing this one issue and releasing it is an easy fix to
publish... there isn't much to test, it simply won't work for 3.0.2 or later
without the fix, and it works fine with it. It seems like such a shame
that people can't build it and therefore don't even give it a try, myself
included, because I tried to get this to work years ago and didn't take the
time to figure it out back then.
Now that I have it working, I have run a few of the example programs, and I
must say it looks really great! I wish I took the time to get it working
sooner. It seems a lot easier than fiddling around with windows API calls.
James
-----Original Message-----
From: fpc-pascal <fpc-pascal-bounces at lists.freepascal.org> On Behalf Of
James Richters via fpc-pascal
Sent: Friday, November 29, 2024 4:58 PM
To: 'FPC-Pascal users discussions' <fpc-pascal at lists.freepascal.org>
Cc: James Richters <james.richters at productionautomation.net>; 'Graeme
Geldenhuys' <mailinglists at geldenhuys.co.uk>
Subject: [fpc-pascal] FPGUI on Windows
Thought this should be a separate thread... sorry it if ends up confusing
things.
I'm trying to get FPGUI to work on Windows 10 with just FPC without Lazarus,
and I'm just not having any luck.
These seem to be three ways to install FPGUI on Windows.
1. Build it from a command line
2. Compile it with the Text IDE
3. Install it with FPCUPDELUXE
I haven't got any of these to work. When I try to build from the command
line I get
fpg_oledragdrop.pas(113,23) Error: No matching implementation for interface
method "SetData(const tagFORMATETC;var TagSTGMEDIUM;LongBool):LongInt;
StdCall;" found See original message below
Next I thought I would try FPCUPDELUXE, so I used it to install a fresh copy
of 3.2.2 and then went to modules to install FPGUI it seems like it's going
to work, but then it gets an error:
Exception: EInOutError. File not open
The info has this:
info: Universal Installer (GetModule: fpgui): Getting module fpgui.
info: Universal Installer (GetModule: fpgui): Going to download/update from
GIT repository https://github.com/graemeg/fpgui.
info: Universal Installer (GetModule: fpgui): Please wait: this can take
some time (if repo is big or has a large history).
info: Performing SVN/GIT/HG/FTP/URL checkout/download. Please wait, could
take some time.
info: Universal Installer (GetModule: fpgui): Download/update from GIT
repository ok.
info: Universal Installer (GetModule: fpgui): No fpgui patches defined.
Then it just stops, and I don't see any fpgui directory in my
units/{Processor} folder which is what I was expecting to happen... maybe
this isn't what's supposed to happen... but it doesn't seem to finish.
So finally I tried the instructions for compiling it with the Text IDE, I
added all the directories required as per the instructions, and randomly
pick a few examples to try to compile, and fpg_base.pas on line 41 I get:
fpg_base.pas(41,32) Error: Parameters or result types cannot contain local
type definitions. Use a separate type definition in a type block.
The line is: TfpgChar = type String[4]; It doesn't seem to like
the [4]
I have tried all kinds of various compiler options like Use AnsiStrings and
just a bunch of random settings like turning optimizations on and off...
because it seems like this would be more of a compiler setting than a bug in
the program, because a bug would have been fixed years ago... so I'm
guessing it's something wrong with how I have it set up, but what I would
need to fix? I have no idea... other than changing the source code... I
guess I could change it to an array of characters or something... but why am
I getting an error at all? Nothing I change allows this line to compile.
So I thought maybe it's because I'm trying to use the current trunk, so I
tried the same thing with 3.2.2, and on there I get: fpg_impl.pas(26,3)
Fatal: Can't find unit x used by fpg_impl Just for fun I commeneded fpg_impl
out and 3.2.2 does get past TfpgChar
= type String[4]; without error... but then there are more errors
because of commenting out fpg_impl. So I feel I might be getting close..
but what is Unit X? and where do I get it? Is there some dependency I need
for FPGUI?
For even more fun I tried to change TfpgChar = type String[4]; to
just TfpgChar = String[4]; in the current trunk, and then that
line does compile, but then I'm back to being unable to find Unit X.
I'm not sure if I have some setting in a way that FPGUI doesn't expect it to
be, or what the issue is, I just don't know where to look. I don't know
what Unit X is or why I don't have it. It looks like a really cool package
and I hope I can get it working. I have some GDI windows in my FPC projects,
but FPGUI looks a lot easier to implement and a lot less confusing.
James
------Original Message-----
>>That builds the whole GUI toolkit from the command line. Works on
>>Windows,
MacOS, Linux and FreeBSD.
I'm intrigued by FPGUI, I'm trying to build FPGUI on Windows 10, and I'm
having some difficulty. When I follow the instructions from Install.txt I
get this:
R:\fpgui_src_1.4.1\fpgui-1.4.1\src>build
"You've got the correct output lib directory"
Compiling GDI CoreLib
Free Pascal Compiler version 3.2.2 [2021/05/15] for i386 Copyright (c)
1993-2021 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling
corelib\gdi\fpgui_toolkit.pas Compiling .\corelib\fpg_base.pas Compiling
corelib\gdi\fpg_impl.pas Compiling .\corelib\fpg_main.pas Compiling
.\corelib\fpg_constants.pas Writing Resource String Table file:
fpg_constants.rsj Compiling corelib\gdi\fpg_interface.pas Compiling
corelib\gdi\fpg_gdi.pas Compiling corelib\gdi\fpg_oledragdrop.pas
fpg_oledragdrop.pas(113,23) Error: No matching implementation for interface
method "SetData(const tagFORMATETC;var TagSTGMEDIUM;LongBool):LongInt;
StdCall;" found
fpg_oledragdrop.pas(203,1) Fatal: There were 1 errors compiling module,
stopping
Fatal: Compilation aborted
Error: I:\Programming\FPC\3.2.2\bin\i386-Win32\ppc386.exe returned an error
exitcode
Anyone have any ideas what I'm doing wrong? This is all way over my head
I'm afraid.
James
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list