Jump to content

Uwe Raabe

Members
  • Content Count

    2750
  • Joined

  • Last visited

  • Days Won

    162

Everything posted by Uwe Raabe

  1. In modern Delphi versions I try to combine record constructors and array concatenation to achieve that: program Project481; {$APPTYPE CONSOLE} type TSomeRec = record SomeField: Integer; public constructor Create(ASomeField: Integer); end; TMyArr = TArray<TSomeRec>; constructor TSomeRec.Create(ASomeField: Integer); begin SomeField := ASomeField; end; procedure Main; var myArr: TMyArr; myRec: TSomeRec; begin myArr := [TSomeRec.Create(0), TSomeRec.Create(1)]; myArr := myArr + [TSomeRec.Create(2)]; Insert([TSomeRec.Create(3)], myArr, 1); for myRec in myArr do begin Writeln(myRec.SomeField); end; Readln; end; begin Main; end.
  2. Project Magician and Selective Debugging are supporting Delphi 10.3 Rio. https://www.uweraabe.de/Blog/2018/11/23/delphi-10-3-rio/ (with download links)
  3. Nothing specific. Does it show in the Info - About dialog under Installed Products? Does the Project Magician menu item exist under the Project menu? BTW, the latter will also give you access to the Global settings.
  4. … reset the IDE Insight toolbar! When IDE Insight suddenly stops working…
  5. Exactly! Check Supported Target Platforms: http://docwiki.embarcadero.com/RADStudio/Rio/en/Supported_Target_Platforms
  6. Uwe Raabe

    Include unused class and its RTTI in the executable

    In case the compiler can evaluate that condition, that might be an issue, but there are many ways to play on the safe side there. Actually creating and freeing the class may come with some costs, though.
  7. Uwe Raabe

    Include unused class and its RTTI in the executable

    That is pretty similar to the original approach described in the topic. In addition, there it is wrapped in a never-true condition to avoid being executed.
  8. In addition you have to add a registry entry in the appropriate BDS Experts key similar to that in the Tokyo one. When I find some time I might add a proper setup.
  9. Uwe Raabe

    Format uses clauses for many units

    Not from inside MMX, but there is a command line tool (see attached). You only have to provide a settings file, like the example provided. UsesCleaner.zip
  10. Uwe Raabe

    ThemesEnabled deprecated..

    I am pretty sure that your code is inside a class derived from TCustomStyleServices (unless you are using with). As ThemesEnabled is a member of TCustomStyleServices so is Enabled. Simply change that ThemesEnabled to Enabled and you should be fine.
  11. Given that file access is almost sequential (remember how hard drives work), I assume that the OS will serialize those parallel tasks in the end anyway. But perhaps I am just missing something.
  12. Uwe Raabe

    MMX for Delphi 10.3 Rio

    Actually, I would hate reading such code. It is distracting and extends the amount to read with no real information gain. It's a TButton - I don't care where it is declared. If I want to know I use Code Insight. There already is such an AddIn and it is called Pascal Expert. The corresponding report is STWA2:
  13. Uwe Raabe

    MMX for Delphi 10.3 Rio

    If Contains means a simple text search and given your example above, that would return the first unit where TButton is used or declared. Actually, there exists something like that in MMX used for auto adding units to the uses clause when a specific type is used (see General Settings under Parsing). Unfortunately, in my opinion, that too often gives false results, because it relies on pre-scanned units and not resolving the units found inside the uses clauses.
  14. Uwe Raabe

    MMX for Delphi 10.3 Rio

    Let's take that as a sign that implementing this feature is probably far from easy.
  15. Uwe Raabe

    MMX for Delphi 10.3 Rio

    Unfortunately that is way more complicated than resolving the unit scope names. It requires to find out where that identifier is declared with respect to the current scope and uses clauses. While Code Insight does have this information and therefore can offer this "Find Declaration" functionality (with all its quirks), MMX does not and it is not planned to support it. Perhaps, when somewhere in the future MMX uses some sort of compile or syntax check, this might be easier to implement. For the moment it is simply out of bounds. BTW, one of the advantages of MMX is that it usually still works even when the code does not compile. That is because it doesn't use a compiler to analyze the sources.
  16. Uwe Raabe

    MMX for Delphi 10.3 Rio

    No.
  17. The idea was that the search paths are taken from the current project configuration. Seems like that is not the case here. I wonder if these settings will become obsolete whenever that mechanism actually works and they are auto-updated whenever the project or its current build configuration changes. That would leave the $IF Expressions and the Lattix LDP file as the only adjustable values (not sure if the latter is actually used by anyone else than myself).
  18. I wonder if the situation on G+ has been any different.
  19. Just uploaded V1.0.8 with Rio Support
  20. This release addresses problems with disabled IDE themes and Delphi 10.2 Tokyo releases below 10.2.3 (and some smaller bugs): https://www.mmx-delphi.de/2018/12/31/bugfix-release-for-mmx-code-explorer/
  21. Uwe Raabe

    Forward declarations

    Basically it is like declaring the class interface where it is needed and move the implementation to another unit. Very similar to interfaces - just another approach.
  22. Uwe Raabe

    Forward declarations

    No. you have to copy the methods from TPerson as abstract methods to TAbstractPerson. Any properties go to TAbstractPerson with abstract Getters and Setters.
  23. Uwe Raabe

    Forward declarations

    What about TPerson -> TAbstractPerson -> TAmStateObject ?
  24. Uwe Raabe

    Forward declarations

    Besides Interfaces there are also abstract classes to accomplish this. unit TestA; interface type TAbstractTestB = class public procedure Test; virtual; abstract; end; TTestA = class public M_TestB: TAbstractTestB; constructor Create; end; implementation uses TestB; constructor TTestA.Create; begin inherited Create; M_TestB := TTestB.Create; end. unit TestB; interface uses TestA; type TTestB = class (TAbstractTestB) M_TestA: TTestA; public procedure Test; override; end; implementation procedure TTestB.Test; begin end; end. Depending on where M_TestB is assigned, you assign either a TTestB instance or create one. You can even create that instance inside TTestA as you are allowed to use unit TestB in the implementation section of TestA as shown above. Nevertheless I suggest to remove these cyclic class dependencies altogether, but the way to do so depends heavily on your use case and the framework you are using.
  25. Uwe Raabe

    How to deal with different types of Variant?

    There are several functions to simplify your task. You can use VarIsStr to check for string variants and VasIsOrdinal for the Integer case. Also there is VarToStr to convert a Variant to string. With this you can strip down your compare function to function CompareValues(const aValue1, aValue2: Variant): integer; overload; Begin Result := 0; // if ANY of the values is string, should compare as strings! if VarIsStr(aValue1) or VarIsStr(aValue2) then Result := CompareValues(VarToStr(aValue1), VarToStr(aValue2)) else if VarIsOrdinal(aValue1) and VarIsOrdinal(aValue2) then // Make sure that the following cast succeeds! Result := CompareValues(Integer(aValue1), Integer(aValue2)); End;
×