Code completion not working in a conditional statement that includes negation lazarus / 9-Editor ---------------------------------------------------------------------- om_os · 2016-07-07 20:08 In the IDE I am able to get parameter hints and code completion in the following case: {$IFC Target_Windows}    PROCEDURE TTextList.UnloadStuff;    BEGIN       IF fMyLoaded THEN                             <-- putting the cursor on fMyLoaded shows its type       BEGIN          fMyArray.ResizeArray(0);            <-- typing a '.' after fMyArray shows the possible functions allowed BUT using the same code with {$IFC NOT Target_iPhoneOS} does not show any hints or code completion. My project custom options are : -Sx -gttt -dTarget_Windows:=TRUE -dTarget_MacOSX:=FALSE -dTarget_iPhoneOS:=FALSE ---------------------------------------------------------------------- Leledumbo · 2016-07-08 08:57 Codetools follows conditional compilation. If a symbol is not defined, the respective code block will be ignored. ---------------------------------------------------------------------- om_os · 2016-07-08 15:52 So a -dTarget_iPhoneOS:=FALSE is considered 'not defined'? Shouldn't the code within      {$IFC NOT Target_iPhoneOS} behave the same as the code within      {$IFC Target_Windows} ? It used to behave the same in Laz 1.2.  Can you think of a workaround that will still compile for other platforms? I am really desperate to find a workaround that will work for all platforms and still will give me code completion etc. ---------------------------------------------------------------------- Thaddy · 2016-07-08 16:14 I wouldn't use {$IFC} but just {$IF} and I would not use NOT in this way.  The {$IFC} stuff is strictly macpas syntax and unless you indeed use that dialect to compile for all platforms absolutely not necessary. So drop the C. Use Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$IF NOT Defined(TARGET_IPHONE_OS)} may be helpful, though. And works... ---------------------------------------------------------------------- om_os · 2016-07-08 16:26 The $IF with NOT that you gave as example is not working for me either. Sorry. ---------------------------------------------------------------------- molly · 2016-07-08 17:05 Try: Code: [Select]{$IFNDEF Target_iPhoneOS}  ... put in here your conditional code ... {$ENDIF} You can check/use each condition by defining it in top of your source manually. Code: [Select]{$DEFINE Target_iPhoneOS} {$DEFINE Target_windows} But... i would only recommend to use such defines for platforms that are difficult to distinguish, e.g. Windows already has enough defines, as well as Linux and MacOS (amongst others). Or at the least base your defines on existing ones as much as possible. Code: [Select]{$IFDEF WINDOWS}   {$DEFINE Target_windows} {$ENDIF} Keep in mind though. Codetools is only able to help you when the corresponding underlying code is 'activate' as well. And i believe there lies your problem, because you did not show where/how TTextList is 'conditioned'. I seem to remember an issue in bugtracker which mentions "if" conditional processing issues. ---------------------------------------------------------------------- om_os · 2016-07-08 22:15 Molly,  thank you for taking the time to elaborate. My TTextList is 'condtioned' - defined with the same {$IFC NOT Target_iPhoneOS}. I cannot use IFDEF because we need to be macPascal compatible. It seems like the IDE has a bug in version 1.6 on a negative $IFC in the declaration. Trying a somewhat positive condition like this -- did not generate different results: {$IFC Target_iPhoneOS} {$ELSEC}    define TExtLIst object and some constants {$ENDC} Does anyone else see this bug? ---------------------------------------------------------------------- molly · 2016-07-08 22:58 Quote from: om_os on July 09, 2016, 12:15:43 amI cannot use IFDEF because we need to be macPascal compatible. Ah, sorry. i did not realized that. QuoteIt seems like the IDE has a bug in version 1.6 on a negative $IFC in the declaration. ... Does anyone else see this bug? It might perhaps be related to this bugreport. Someone with more knowledge on the subject required to make sure. ---------------------------------------------------------------------- Thaddy · 2016-07-09 06:35 No, it's not. BTW:the different ways of using conditionals are more or less independent of the modes. I suggest you use this, which is tested: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program testdef;{$IF NOT Defined(TARGET_IPHONE_OS)}{$mode objfpc}{$ELSE}{$mode macpas}{$IFEND}begin{$IF NOT Defined(TARGET_IPHONE_OS)}writeln('This is not for an iPhone');{$ELSE}writeln('For iPhone');{$IFEND}end. ---------------------------------------------------------------------- marcov · 2016-07-09 07:40 Quote from: om_os on July 08, 2016, 05:52:25 pmSo a -dTarget_iPhoneOS:=FALSE is considered 'not defined'? Try changing the := to = := defines a macro, = defines a conditional.