Sign in Join
Wiki copytemporary

Revision 2 of 2, by WikiArchive on 11-4-2026. The page as it is now.

IDE Window: Conditional Defines

Utility to assist in inserting conditional defines. For example, to convert

pascal
  OnCreate := @CreateHandler

to:

pascal
  OnCreate := {$IFDEF FPC} @ {$ENDIF} CreateHandler

select @ and then use Edit, insert $IFDEF (default shortcut Ctrl+Shift+D), select "FPC,NONE" and hit return. If you select one or more complete lines then the conditional defines are put on sepearate lines as in:

pascal
  {$IFDEF DEBUG}
  Writeln('State= ', State)
  {$ENDIF}

The choices are listed in abbreviated form so:

This tool is most useful when you need to put several identical conditionals in a file, you can add to the possible conditionals by selecting or typing the required symbols in "First test" and /or "Second test" and using the Add button.

Your additons are saved in the condef.xml file in the lazarus configuration directory.


From the Free Pascal wiki, page "IDE Window: Conditional Defines", as it stood on 2020-02-17 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.