-
Content Count
2750 -
Joined
-
Last visited
-
Days Won
162
Everything posted by Uwe Raabe
-
appending to a dynamic array
Uwe Raabe replied to dummzeuch's topic in Algorithms, Data Structures and Class Design
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. -
Project Magician and Selective Debugging and Delphi 10.3 Rio
Uwe Raabe posted a topic in Delphi Third-Party
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) -
Project Magician and Selective Debugging and Delphi 10.3 Rio
Uwe Raabe replied to Uwe Raabe's topic in Delphi Third-Party
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. -
When IDE Insight suddenly stops working…
Uwe Raabe posted a topic in Tips / Blogs / Tutorials / Videos
… reset the IDE Insight toolbar! When IDE Insight suddenly stops working… -
Delphi 10.3 Rio: Impossible to find entry point "GetProductInfo" under WinXP
Uwe Raabe replied to Silver Black's topic in RTL and Delphi Object Pascal
Exactly! Check Supported Target Platforms: http://docwiki.embarcadero.com/RADStudio/Rio/en/Supported_Target_Platforms -
Include unused class and its RTTI in the executable
Uwe Raabe replied to Attila Kovacs's topic in General Help
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. -
Include unused class and its RTTI in the executable
Uwe Raabe replied to Attila Kovacs's topic in General Help
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. -
ModelMaker IDE Integration Expert for Delphi 10.3 Rio released
Uwe Raabe replied to Uwe Raabe's topic in MMX Code Explorer
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. -
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
-
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.
-
Opinions solicited: Parallel processing to delete 40+Gig file structure?
Uwe Raabe replied to KeithLatham's topic in RTL and Delphi Object Pascal
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. -
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:
-
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.
-
Let's take that as a sign that implementing this feature is probably far from easy.
-
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.
-
additional path is not stored on unit dependency analyzer
Uwe Raabe replied to ULIK's topic in MMX Code Explorer
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). -
Is there already a statistic about the new registrations?
Uwe Raabe replied to sh17's topic in Community Management
I wonder if the situation on G+ has been any different. -
Project Magician and Selective Debugging and Delphi 10.3 Rio
Uwe Raabe replied to Uwe Raabe's topic in Delphi Third-Party
Just uploaded V1.0.8 with Rio Support -
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/
-
Forward declarations
Uwe Raabe replied to Berocoder's topic in Algorithms, Data Structures and Class Design
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. -
Forward declarations
Uwe Raabe replied to Berocoder's topic in Algorithms, Data Structures and Class Design
No. you have to copy the methods from TPerson as abstract methods to TAbstractPerson. Any properties go to TAbstractPerson with abstract Getters and Setters. -
Forward declarations
Uwe Raabe replied to Berocoder's topic in Algorithms, Data Structures and Class Design
What about TPerson -> TAbstractPerson -> TAmStateObject ? -
Forward declarations
Uwe Raabe replied to Berocoder's topic in Algorithms, Data Structures and Class Design
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. -
How to deal with different types of Variant?
Uwe Raabe replied to Mike Torrettinni's topic in General Help
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;