Difference between revisions of "IDE Window: Conditional Defines"
From Free Pascal wiki
Jump to navigationJump to searchm (Fixed syntax highlighting) |
|||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
Utility to assist in inserting conditional defines. For example, to convert | Utility to assist in inserting conditional defines. For example, to convert | ||
+ | |||
+ | <syntaxhighlight lang=pascal> | ||
OnCreate := @CreateHandler | OnCreate := @CreateHandler | ||
+ | </syntaxhighlight> | ||
+ | |||
to: | to: | ||
+ | |||
+ | <syntaxhighlight lang=pascal> | ||
OnCreate := {$IFDEF FPC} @ {$ENDIF} CreateHandler | OnCreate := {$IFDEF FPC} @ {$ENDIF} CreateHandler | ||
+ | </syntaxhighlight> | ||
+ | |||
select '''@''' and then use '''Edit''', insert '''$IFDEF''' (default shortcut Ctrl+Shift+D), | 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 | 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: | conditional defines are put on sepearate lines as in: | ||
+ | |||
+ | <syntaxhighlight lang=pascal> | ||
{$IFDEF DEBUG} | {$IFDEF DEBUG} | ||
Writeln('State= ', State) | Writeln('State= ', State) | ||
{$ENDIF} | {$ENDIF} | ||
+ | </syntaxhighlight> | ||
The choices are listed in abbreviated form so: | The choices are listed in abbreviated form so: |
Latest revision as of 10:38, 17 February 2020
│
Deutsch (de) │
English (en) │
français (fr) │
Utility to assist in inserting conditional defines. For example, to convert
OnCreate := @CreateHandler
to:
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:
{$IFDEF DEBUG}
Writeln('State= ', State)
{$ENDIF}
The choices are listed in abbreviated form so:
- MSWINDOWS,UNIX => {$IFDEF MSWINDOWS} ... {$ENDIF} {$IFDEF UNIX} ... {$ENDIF}
- FPC,ELSE => {$IFDEF FPC} ... {$ELSE} ... {$ENDIF}
- DEBUG,NONE => {$IFDEF DEBUG} ... {$ENDIF}
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.