[Lazarus] What are "widgets" in lazarus?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Wed Jan 5 15:06:08 CET 2011


Bo Berglund wrote:

>> Bo, I suggest that you check that your board supports GTK etc. If it 
>> doesn't support GTK but it does have basic X graphics then fpGUI might 
>> be the least painful option.

> Back again so I could read up on this thread...
> 
> So basically a widget set is a definition on what kind of graphics
> environment is used on the target system then?

No, it's one or more libraries installed on the system which contain all 
the code to draw standard controls- buttons and so on- on the underlying 
graphics provided by the operating system. There is a handful of widget 
sets- Windows, Qt and GTK for example- and a smaller number of 
underlying graphics subsystems- Windows and X as examples.

Note that in that case there is a part of Windows that implements a 
widget set, and a part that implements low-level graphics. It's possible 
to have the Qt widget set (and possibly others) on top of Windows's 
low-level graphics.

> What about making a program for Linux? Do we have to compile the same
> program in different versions for different desktop managers on Linux?
> Like one for Gnome, another for KDE and yet another for X???
> Sounds mighty tedious and error prone...

The LCL provides an interface between your program and the available 
widget set, all you have to do is set the project options to tell it 
which to use at which point Lazarus or lazbuild does the work for you. X 
is a red herring since it's at a lower level than a widget set.

I can't speak for anybody else, but I generally compile for GTK v1, v2, 
Qt and Windows, depending on the underlying OS. If you set your target 
file name to something like 
myproject-$(TargetCPU)-$(TargetOS)-$(LCLWidgetType) Lazarus/lazbuild 
will create distinct binaries for all combinations, the only gotcha is 
that you need to make sure that the libraries implementing the widget 
set are present on the target system.

> My first project is to make an embedded application but develop it on
> a Windows host where I also want it to be running for checks etc.
> This application needs some basic graphics, like using Canvas methods
> to draw simple geometric forms on an image.

No. Your first project is a simple form with one button on it that 
displays "Hello, World!" in a panel. Trust me.

> The embedded card is a touch panel from Technologic Systems
> (http://www.embeddedarm.com/products/board-detail.php?product=TS-TPC-7390#),
> which runs an embedded version of Debian Linux, I believe.
> If it supports GTK (what is that?)

I've told you: it's a widget set. And I've told you what a widget set is 
as well :-)

 > or not I don't know but I will ask them.

You don't have to ask them. Run

dpkg --get-selections |grep gtk

and expect to see output something like

libgpod3-nogtk                                  install
libgtk1.2                                       install
libgtk1.2-common                                install
libgtk1.2-dev                                   install
libgtk2.0-0                                     install
libgtk2.0-common                                install
libgtk2.0-dev                                   install
libgtkglext1                                    install
libgtkhtml2-0                                   install
libwxgtk2.6-0                                   install
libwxgtk2.8-0                                   install
pinentry-gtk2                                   install
python-gtk2                                     install

Note the -dev packages, which contain all the development (header etc.) 
files. If it's a comparatively recent Debian then it will almost 
certainly have the GTK v2 libraries, if it's an older one it might only 
have v1. Lazarus currently defaults to v2 of GTK rather than v1, v1 is 
deprecated with limited support.

If you don't have the libraries or the development packages then 
installing them is fairly simple. However as recently discussed that's 
not strictly the role of this mailing list: I'm sure that everybody in 
here is happy to help, but what a particular reseller is doing with an 
unspecified version of a standard distro is ultimately not our 
responsibility.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list