| 1 | | - | [](</File:GTK_logo.svg>) |
| 2 | | - | |
| 3 | | - | This article applies to [GTK+ Widgetsets](</Category:GTK_Widgetsets> "Category:GTK Widgetsets") only. |
| 4 | | - | |
| 5 | | - | See also: [[Multiplatform Programming Guide]] |
| 6 | | - | |
| 7 | | - | [](</File:Warning-icon.png>) |
| 8 | | - | |
| 9 | | - | **Warning:** Gtk 1 development has been discontinued. The [[GTK2 Interface]] is now the default interface for *nix. Patches however are still accepted to fix compilation when Gtk1 breaks. There are no core Lazarus developers that still use the gtk1 interface. The information below may be outdated. |
| 10 | | - | |
| 11 | | - | ## Contents |
| 1 | + | *(GTK+ only)* |
| 12 | 2 | | |
| 13 | | - | * 1 Introduction |
| 14 | | - | * 2 Other Interfaces |
| 15 | | - | * 2.1 Platform specific Tips |
| 16 | | - | * 2.2 Interface Development Articles |
| 17 | | - | * 3 Using the Gtk1 interface under macOS |
| 18 | | - | * 3.1 Required software |
| 19 | | - | * 3.1.1 If you decide not to use Fink or if your Fink installation is customized |
| 20 | | - | * 3.2 How to get going |
| 21 | | - | * 3.3 Lazarus as Icon |
| 3 | + | > **Warning:** Gtk 1 development has been discontinued. The [[GTK2 Interface]] is now the default interface for *nix. Patches however are still accepted to fix compilation when Gtk1 breaks. There are no core Lazarus developers that still use the gtk1 interface. The information below may be outdated. |
| 22 | 4 | | |
| 23 | 5 | | ## Introduction |
| 24 | 6 | | |
| 25 | | - | The gtk1 widgetset is quite stable. There are still some bugs and missing properties. |
| 26 | | - | |
| 27 | | - | The documentation can be found [here](<http://www.gtk.org/>). |
| 28 | | - | |
| 29 | | - | The minimum Gtk 1 version supported is Gtk 1.2.18 |
| 30 | | - | |
| 31 | | - | ## Other Interfaces |
| 7 | + | The gtk1 widgetset is quite stable. There are still some bugs and missing properties. |
| 32 | 8 | | |
| 33 | | - | * [[Lazarus known issues \(things that will never be fixed\|Lazarus known issues (things that will never be fixed)]]> "Lazarus known issues \(things that will never be fixed\)") \- A list of interface compatibility issues |
| 34 | | - | * [[Win32/64 Interface]] \- The Windows API (formerly Win32 API) interface for Windows 95/98/Me/2000/XP/Vista/10, but not CE |
| 35 | | - | * [[Windows CE Interface]] \- For Pocket PC and Smartphones |
| 36 | | - | * [[Carbon Interface]] \- The Carbon 32 bit interface for macOS (deprecated; removed from macOS 10.15) |
| 37 | | - | * [[Cocoa Interface]] \- The Cocoa 64 bit interface for macOS |
| 38 | | - | * [[Qt Interface]] \- The Qt4 interface for Unixes, macOS, Windows, and Linux-based PDAs |
| 39 | | - | * [[Qt5 Interface]] \- The Qt5 interface for Unixes, macOS, Windows, and Linux-based PDAs |
| 40 | | - | * GTK1 Interface \- The gtk1 interface for Unixes, macOS (X11), Windows |
| 41 | | - | * [[GTK2 Interface]] \- The gtk2 interface for Unixes, macOS (X11), Windows |
| 42 | | - | * [[GTK3 Interface]] \- The gtk3 interface for Unixes, macOS (X11), Windows |
| 43 | | - | * [[fpGUI Interface]] \- Based on the fpGUI library, which is a cross-platform toolkit completely written in Object Pascal |
| 44 | | - | * [[Custom Drawn Interface]] \- A cross-platform LCL backend written completely in Object Pascal inside Lazarus. The Lazarus interface to Android. |
| 9 | + | The documentation can be found [here](http://www.gtk.org/). |
| 45 | 10 | | |
| 46 | | - | ### Platform specific Tips |
| 11 | + | The minimum Gtk 1 version supported is Gtk 1.2.18 |
| 47 | 12 | | |
| 48 | | - | * [[Android Programming]] \- For Android smartphones and tablets |
| 49 | | - | * [[iPhone/iPod development]] \- About using Objective Pascal to develop iOS applications |
| 50 | | - | * [[FreeBSD Programming Tips]] \- FreeBSD programming tips |
| 51 | | - | * [[Linux Programming Tips]] \- How to execute particular programming tasks in Linux |
| 52 | | - | * [[macOS Programming Tips]] \- Lazarus tips, useful tools, Unix commands, and more... |
| 53 | | - | * [[WinCE Programming Tips]] \- Using the telephone API, sending SMSes, and more... |
| 54 | | - | * [[Windows Programming Tips]] \- Desktop Windows programming tips |
| 13 | + | ## Using the Gtk1 interface under macOS |
| 55 | 14 | | |
| 56 | | - | ### Interface Development Articles |
| 15 | + | If you want to build gtk1 applications on macOS you need X11 and GTK 1.2 too: |
| 57 | 16 | | |
| 58 | | - | * [[Carbon interface internals]] \- If you want to help improving the Carbon interface |
| 59 | | - | * [[Windows CE Development Notes]] \- For Pocket PC and Smartphones |
| 60 | | - | * [[Adding a new interface]] \- How to add a new widget set interface |
| 61 | | - | * [[LCL Defines]] \- Choosing the right options to recompile LCL |
| 62 | | - | * [[LCL Internals]] \- Some info about the inner workings of the LCL |
| 63 | | - | * [[Cocoa Internals]] \- Some info about the inner workings of the Cocoa widgetset |
| 17 | + | Apple X11: On a new system: choose "Customize" in the install dialog, check "X11". |
| 64 | 18 | | |
| 65 | | - | ## Using the Gtk1 interface under macOS |
| 19 | + | On an already installed system: |
| 66 | 20 | | |
| 67 | | - | If you want to build gtk1 applications on macOS you need X11 and GTK 1.2 too: |
| 21 | + | MacOSX 10.3: download at: |
| 68 | 22 | | |
| 69 | | - | Apple X11: On a new system: choose "Customize" in the install dialog, check "X11". |
| 23 | + | |
| 24 | + | <http://www.apple.com/downloads/macosx/apple/x11formacosx.html> |
| 70 | 25 | | |
| 71 | | - | On an already installed system: |
| 26 | + | MacOSX 10.4: install X11 from the DVD. |
| 72 | 27 | | |
| 73 | | - | MacOSX 10.3: download at: |
| 28 | + | GTK 1.2: Downloading the GTK packages and installing them properly can be a time consuming task. Therefore there are various package managers. One of them is fink: |
| 74 | 29 | | |
| 75 | | - | <http://www.apple.com/downloads/macosx/apple/x11formacosx.html> |
| 30 | + | |
| 31 | + | Download fink from <http://fink.sourceforge.net/download/index.php?phpLang=en>; follow the install instructions. |
| 76 | 32 | | |
| 77 | | - | MacOSX 10.4: install X11 from the DVD. |
| 33 | + | In the Terminal, run |
| 78 | 34 | | |
| 79 | | - | GTK 1.2: Downloading the GTK packages and installing them properly can be a time consuming task. Therefore there are various package managers. One of them is fink: |
| 35 | + | ` sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines` |
| 80 | 36 | | |
| 81 | | - | Download fink from <http://fink.sourceforge.net/download/index.php?phpLang=en>; follow the install instructions. |
| 37 | + | The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click. X11 on Leopard (10.5) is different and starting X11.app is not recommended. |
| 82 | 38 | | |
| 83 | | - | In the Terminal, run |
| 84 | | - | ``` |
| 85 | | - | sudo /sw/bin/apt-get install gdk-pixbuf gtk+ gtk+-data gtk+-shlibs gtk-doc gtk-engines |
| 86 | | - | ``` |
| 39 | + | Tip: Most X11 programs, including Lazarus, expect to receive focus when the user clicks on a window. Under macOS this is deactivated. You can activate it for all X11 applications by typing in the terminal: |
| 87 | 40 | | |
| 88 | | - | The X11 application is in /Applications/Utilities/X11. You can drag and drop it on the dock so you can start it with one click. X11 on Leopard (10.5) is different and starting X11.app is not recommended. |
| 41 | + | ` defaults write com.apple.x11 wm_click_through -bool true` |
| 89 | 42 | | |
| 90 | | - | Tip: Most X11 programs, including Lazarus, expect to receive focus when the user clicks on a window. Under macOS this is deactivated. You can activate it for all X11 applications by typing in the terminal: |
| 91 | | - | ``` |
| 92 | | - | defaults write com.apple.x11 wm_click_through -bool true |
| 93 | | - | ``` |
| 43 | + | When compiling GTK-related software, you need to add two lines to the fpc.cfg file, to enable use of libraries: |
| 94 | 44 | | |
| 95 | | - | When compiling GTK-related software, you need to add two lines to the fpc.cfg file, to enable use of libraries: |
| 96 | | - | ``` |
| 97 | | - | -Fl/sw/lib |
| 98 | | - | -Fl/usr/X11R6/lib |
| 99 | | - | ``` |
| 45 | + | `-Fl/sw/lib`\ |
| 46 | + | `-Fl/usr/X11R6/lib` |
| 100 | 47 | | |
| 101 | 48 | | ### Required software |
| 102 | 49 | | |
| 103 | | - | * Install Apple´s X11, available on your Installation Disk. |
| 50 | + | - Install Apple´s X11, available on your Installation Disk. |
| 104 | 51 | | |
| 105 | | - | For **Jaguar 10.2.x** you can download X11 on source forge at the [X11 on Mac](<http://sourceforge.net/projects/xonx>) Project. |
| 52 | + | For **Jaguar 10.2.x** you can download X11 on source forge at the [X11 on Mac](http://sourceforge.net/projects/xonx) Project. |
| 106 | 53 | | |
| 107 | | - | For **Panther 10.3.x** (but not for any other version!) also at [Apple](<http://www.apple.com/downloads/macosx/apple/x11formacosx.html>). |
| 54 | + | For **Panther 10.3.x** (but not for any other version!) also at [Apple](http://www.apple.com/downloads/macosx/apple/x11formacosx.html). |
| 108 | 55 | | |
| 109 | | - | For **Tiger 10.4** you must install X11 from your tiger DVD. This is to be able to display X11 programs. Tip: Drag the X11-Icon from /Applications/Utilities/X11 into the Dock for convenient starting. |
| 56 | + | For **Tiger 10.4** you must install X11 from your tiger DVD. This is to be able to display X11 programs. Tip: Drag the X11-Icon from /Applications/Utilities/X11 into the Dock for convenient starting. |
| 110 | 57 | | |
| 111 | | - | * Install Apple´s XCode, available on your Mac Installation Disk or at [Apple Developer Connection](<http://connect.apple.com/>) (requires creation of account, but the free online program is enough). This installs the XCode IDE and all the developer stuff. |
| 112 | | - | * Install fink, available at [Sourceforge](<http://fink.sourceforge.net/>). This is a Mac 'apt-get'esque package system. |
| 113 | | - | * Check if installation was successful, open a Terminal and type: |
| 58 | + | - Install Apple´s XCode, available on your Mac Installation Disk or at [Apple Developer Connection](http://connect.apple.com/) (requires creation of account, but the free online program is enough). This installs the XCode IDE and all the developer stuff. |
| 59 | + | - Install fink, available at [Sourceforge](http://fink.sourceforge.net/). This is a Mac 'apt-get'esque package system. |
| 60 | + | - Check if installation was successful, open a Terminal and type: |
| 114 | 61 | | |
| 115 | | - | ``` |
| 116 | | - | echo $PATH |
| 117 | | - | ``` |
| 62 | + | ` echo $PATH` |
| 118 | 63 | | |
| 119 | | - | This should give you: |
| 120 | | - | ``` |
| 121 | | - | /sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin |
| 122 | | - | ``` |
| 64 | + | This should give you: |
| 123 | 65 | | |
| 124 | | - | * After successfull installation of the above, open a Terminal and type: |
| 66 | + | ` /sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin`\ |
| 125 | 67 | | |
| 126 | | - | ``` |
| 127 | | - | sudo apt-get update |
| 128 | | - | sudo apt-get install glib glib-shlibs gtk+-shlibs gdk-pixbuf gdk-pixbuf-shlibs |
| 129 | | - | ``` |
| 68 | + | - After successfull installation of the above, open a Terminal and type: |
| 130 | 69 | | |
| 131 | | - | |
| 132 | | - | This installs GTK. |
| 70 | + | sudo apt-get update |
| 71 | + | sudo apt-get install glib glib-shlibs gtk+-shlibs gdk-pixbuf gdk-pixbuf-shlibs |
| 133 | 72 | | |
| 134 | | - | * Install [fpc and Lazarus](<http://sourceforge.net/project/showfiles.php?group_id=89339>) as .dmg for Mac. Now your´re ready to run. |
| 73 | + | This installs GTK. |
| 135 | 74 | | |
| 136 | | - | |
| 75 | + | - Install [fpc and Lazarus](http://sourceforge.net/project/showfiles.php?group_id=89339) as .dmg for Mac. Now your´re ready to run. |
| 137 | 76 | | |
| 138 | | - | #### If you decide not to use Fink or if your Fink installation is customized |
| 77 | + | ====If you decide not to use Fink or if your Fink installation is customized==== If you install `gdk-pixbuf`, `gtk`, and `glib` libraries not using Fink, or if your Fink installation is customized to install under other than `/sw` directory, then make sure that the environment variable `DYLD_LIBRARY_PATH` point to where the libraries are. For instance, it you use [MacPorts](http://www.macports.org/), the command below should do the trick: |
| 139 | 78 | | |
| 140 | | - | If you install `gdk-pixbuf`, `gtk`, and `glib` libraries not using Fink, or if your Fink installation is customized to install under other than `/sw` directory, then make sure that the environment variable `DYLD_LIBRARY_PATH` point to where the libraries are. For instance, it you use [MacPorts](<http://www.macports.org/>), the command below should do the trick: |
| 141 | | - | ``` |
| 142 | | - | export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib:$DYLD_FALLBACK_LIBRARY_PATH" |
| 143 | | - | ``` |
| 79 | + | `export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib:$DYLD_FALLBACK_LIBRARY_PATH"` |
| 144 | 80 | | |
| 145 | | - | The environment variable should be setup every time before running lazarus, or should be run from shell startup script. |
| 81 | + | The environment variable should be setup every time before running lazarus, or should be run from shell startup script. |
| 146 | 82 | | |
| 147 | 83 | | ### How to get going |
| 148 | 84 | | |
| 149 | | - | * Start X11. |
| 150 | | - | * You get your XTerm. Focus it and type |
| 85 | + | - Start X11. |
| 86 | + | - You get your XTerm. Focus it and type |
| 151 | 87 | | |
| 152 | | - | ``` |
| 153 | | - | cd /usr/local/share/lazarus/ |
| 88 | + | cd /usr/local/share/lazarus/ |
| 154 | 89 | | ./lazarus |
| 155 | | - | ``` |
| 156 | 90 | | |
| 157 | 91 | | ### Lazarus as Icon |
| 158 | 92 | | |
| 159 | | - | You can drag and drop the X11 app onto your dock to have a one-click way of starting X11. |
| 93 | + | You can drag and drop the X11 app onto your dock to have a one-click way of starting X11. |
| 160 | 94 | | |
| 161 | | - | To simplify starting Lazarus, in X11, choose Applications | Customize Menu, then click Add. Under Menu Name enter Lazarus, under Command enter the following: |
| 162 | | - | ``` |
| 163 | | - | /usr/local/share/lazarus/lazarus |
| 164 | | - | ``` |
| 95 | + | To simplify starting Lazarus, in X11, choose Applications \| Customize Menu, then click Add. Under Menu Name enter Lazarus, under Command enter the following: |
| 165 | 96 | | |
| 166 | | - | Click Done to close. Now you can start Lazarus from X11 simply by choosing Applications | Lazarus. |
| 97 | + | `/usr/local/share/lazarus/lazarus` |
| 167 | 98 | | |
| 168 | | - | BEWARE: if you use the below svn, then use |
| 169 | | - | ``` |
| 170 | | - | open -a /Users/yourname/pascal/lazarus/lazarus |
| 171 | | - | ``` |
| 99 | + | Click Done to close. Now you can start Lazarus from X11 simply by choosing Applications \| Lazarus. |
| 172 | 100 | | |
| 101 | + | BEWARE: if you use the below svn, then use |
| 102 | + | |
| 103 | + | ` open -a /Users/yourname/pascal/lazarus/lazarus` |
| 104 | + | |
| 173 | 105 | | --- |
| 174 | | - | *From the Free Pascal wiki, page "GTK1 Interface", as the Internet Archive kept it on 2023-02-01. 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](/wiki-contact).* |
| 106 | + | *From the Free Pascal wiki, page "GTK1 Interface", as it stood on 2019-12-22 after a change by Trev, 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](/wiki-contact).* |
| 107 | + | Category: GTK Widgetsets |
| 108 | + | Category: Lazarus |
| 109 | + | Category: macOS |