Sign in Join
Wiki copytemporary

LCL Defines

English · Français

This page documents the defines that can be utilized to recompile the different widgetsets of LCL. It isn´t a comprehensive list, but may become one as more defines are added. It also mentions defines that are automatically set when you select various options, such as widgetset, in Lazarus. See Also Platform defines

Why use defines?

Defines allow to add non-standard functionality to LCL, test experimental features or to add debug output that helps testing the widgetsets.

The defines are also useful as 'read only' for you to determine, for example, to include particular code on particular platforms. For example -

pascal
{$ifdef WINDOWS}
    // do some WINDOWS specific stuff
{$else}
    // do whatever but only on non-windows platforms
{$endif}

Recompiling LCL with a define

To recompile LCL with a special define go to the Lazarus menu Tools -> "Configure Build Lazarus". Add there in the Options field:

text
-d<DEFINE_NAME>

So if you wish to add the PassWin32MessagesToLCL define, you will add

text
-dPassWin32MessagesToLCL

to this box.

General LCL defines

LCL Version

Sometimes its necessary to do things differently depending on the LCL (ie Lazarus) version its going to be compiled with. The LCL_FULLVERSION define can be read like this -

pascal
{$if (lcl_fullversion >= 2000600)}
DoSomething(); // only do this for Lazarus 2.0.6 or later
{$endif}

LCL thinks of its versions in that seven digit number:

PLATFORM

You would not normally set one of these, they are set for you when you choose compile options in Lazarus. Useful to read to make platform specific decisions at compile time.

There are many more ....

Widget Set

You would not normally set one of these, they are set for you when you choose compile options in Lazarus. Useful to read to make widget set specific decisions at compile time.

Win32 defines

WinCE defines

Gtk defines

It's used only for debugging purposes (eg. diff in capturing before old & new code) if some bug is filled against gtk2 capturing.

This define fixes sending/receiving messages via PostMessage() from other threads than main.Also, we hook g_main_context's poll function to make g_main_context_wakeup accurate.From glib2 >= 2.24 g_main_context_wakeup is enough, but for smaller versions we need to check if new message arrived (from another thread), and interrupt main_context_iteration. For those who want to use deprecated gtk_main_* there's USE_GTK_MAIN_OLD_ITERATION.

Old fashioned font names can be used with this define.

needs it just use this define and pls. report issue about gtk2 version and needed dummy notebook page.

Qt defines

You can use the following defines while building LCL to configure your Qt Interface:

Legacy

Many Qt defines have become unnecessary, entries moved here for clarity.

Carbon defines

List of Carbon defines used to show debug info when tracing:

Other defines:

FPC Optimization Defines

There are also a number of defines possible that apply to the FP Compiler - see Optimization in Code

See Also

Free Pascal Compiler Documentation - Compiler defines during compilation such as CPU, Platform, compiler ability etc.


From the Free Pascal wiki, page "LCL Defines", as it stood on 2024-01-26 after a change by Alextpp, 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 3, last changed by WikiArchive .

Talk about this page

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