Sign in Join
Wiki copytemporary

gtk1

The package GTK1 is a header to the GTK 1.x libraries.

Introduction

The GTK+ toolkit and its companion GDK (nowadays included into GTK) are quickly becoming (next to the Qt toolkit) a very popular X-windows programming toolkit. This makes it suitable as a base for the Lazarsu Component Library (LCL, the Lazarus equivalent of the Delphi VCL).

The GTK1 widgetset is not actively maintained anymore. The default widgetset on *nix currently is GTK2.

Windows

Note that while GTK(1) is mostly used on Unix, it is known to work on Windows too, though to our knowledge not tested regularly. Reportedly (bug 12359) the following libraries are required for windows:

Downloading

The gtk units are part of the Free Pascal packages, and are shipped with the official distrubution.

The GTK libraries must be downloaded from the original GTK+ site.

Using the units:

There is an article on programming GTK by Florian Klaempfl and Michael Van Canneyt, written for the German Toolbox magazine. The original English version (in PDF format) can be viewed here. The example programs source code can also be downloaded.

Note that these examples haven't been tested with recent for a while, when you have problems, ask on the maillist

The following is a (very) short explanation of how to use the GTK units. Most of what can be found here is already described in the articles on GTK.

  1. In C, you only need to input gtk.h. Here you need to put gtk, and separately glib or gdk if you need them, in your uses clause.
  2. Names :

Macros. Many C macros have not been translated. The typecasting macros have been dropped, since they're useless under pascal. Macros to access record members have been translated, BUT they are to be considered as READ-ONLY. So they can be used to retrieve a value, but not to store one. e.g.\

function GTK WIDGET FLAGS(wid : pgtkwidget) : longint;\

can be used to retrieve the widget flags, but not to set them. so things like\

GTK WIDGET FLAGS(wid):=GTK WIDGET FLAGS(wid) and someflag;\

will not work, since this is a function, and NOT a macro as in C.

Packed records. GCC allows you to specify members of a record in bit format. Since this is impossible in pascal, functions and procedures to get/set these elements have been made. e.g.\

function width set(var a : TGtkCListColumn) : gint;
procedure set width set(var a : TGtkCListColumn; width set : gint);\

     can be used to get or set the width in a TGtkCListColumn... in general, it's the name with ' set' appended for getting a value (set from 'a set') , and 'set ' prepended (from 'to set') and again ' set' appended. 

There is also an article on programming GTK by Florian Klaempfl and Michael Van Canneyt, written for the German Toolbox magazine. The original English version (in PDF format) can be viewed here. The example programs source code can also be downloaded.

More information about programming GTK is available in the following documents:

*# Article 1 and the sources of the examples can be found here.

*# Article 2 and the sources of the examples can be found here.

*# Article 3 and the sources of the examples can be found here.

*# Article 4 and the sources of the examples can be found here.

*# Article 5 and the sources of the examples can be found here.


From the Free Pascal wiki, page "gtk1", as it stood on 2019-05-08 after a change by Bart, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.