Der schöne Günther
Members-
Content Count
691 -
Joined
-
Last visited
-
Days Won
12
Everything posted by Der schöne Günther
-
I am not familiar with the GExperts formatter, never used it before. Is it true that it is hard-wired to always use spaces for indentation? I only found an option to set "Spaces per Indent". Many thanks in advance.
-
Do I need to free list
Der schöne Günther replied to AlanScottAgain's topic in RTL and Delphi Object Pascal
If a TObjectList<T> has OwnsObjects = True, it will free the contained objects when the list itself is freed. If no one ever frees the list, it will stay in memory, and all its contained objects. You say you produce a new list. If no one else keeps a reference to the old list anymore, it should be freed. Even better, in my opinion, would be not creating new lists all the time, but that you change your helper object so that you pass your already existing list, and it will add the new object to that list, instead of creating its own. This way, you don't have to deal with creating and freeing lists, you just have one single list of the entire lifetime of your outer object. -
We also use GetLastInputInfo() for exactly that (revoking any special permissions on a kiosk system if there has been no input for a few minutes). It's been working fine since we added it in 2016. Keep in mind that the tick count returned by GetLastInputInfo() is just a DWORD - Meaning it will roll over after 49.7 days. Our users were not happy when they were immediately logged out again after the system had been running for more than 50 days 😐
-
how to read included code
Der schöne Günther replied to Lainkes's topic in Algorithms, Data Structures and Class Design
Have you checked and run the example programs in the Samples subdirectory? For example, in Samples/Component Demo, it is a complete application with a EidReader component on the form. This component has several events like OnCardInserted. My suggestion is you just try out the samples, they seem simple enough. -
FreeAndNil() - The Great Delphi Developer Debate
Der schöne Günther replied to AlexBelo's topic in Tips / Blogs / Tutorials / Videos
Oh, in that case, absolutely. Guess I should watch it. -
FreeAndNil() - The Great Delphi Developer Debate
Der schöne Günther replied to AlexBelo's topic in Tips / Blogs / Tutorials / Videos
What did I miss? What I understand is that It is not part of the language, it is just a regular method from the standard library Earlier versions did have an untyped parameter and let you pass in things that were not descendants of TObject If that is all, how can you even have an opinion on that? What is there to talk about? Can somebody get me up to date with just one or two sentences? Many thanks. -
Left side cannot be assigned to
Der schöne Günther replied to AlanScottAgain's topic in RTL and Delphi Object Pascal
That they cannot be passed as var or out was more a comparison to simple fields, I should have made that clearer. Meaning: If you don't need getter/setters, I fail to see why you would ever go with properties at all. -
Left side cannot be assigned to
Der schöne Günther replied to AlanScottAgain's topic in RTL and Delphi Object Pascal
In my absolutely personal opinion, never bother with properties at all. There is no real use for them. They have a lot of other disadvantages - You can't pass them as var or out parameters, Code completion will not tell you if a property is writeable or not. Many other languages are perfectly fine with no properties at all. I can think of C# properties, but they are capable of so much more. In Delphi, a getter/setter makes it immediately clear if a value can be read or written, makes it obvious that there could be side effects as it's not just a regular variable, and can be stored in a function pointer. Also, you can make the setter protected and only allow yourself and your subclasses or another interface to change the value. None of this is possible with properties. In my opinion, they just get in the way and require even more typing as Delphi is already incredibly verbose. -
Left side cannot be assigned to
Der schöne Günther replied to AlanScottAgain's topic in RTL and Delphi Object Pascal
Your variable FBoundsRect is of type TRectF which is a record. Records are passed by value, not by reference. Meaning: When you access TempResult.BoundsRect, you are not acting on the original data, but a copy on it. Yes, in theory, you can access and modify the temporary data, but the compiler does not let you as it makes no sense to do so. The compiler message is unfortunately, once again, not helpful. One solution is storing it in a temporary local variable, and then assigning it back, after you have changed the bounds rect. Another one is getting rid of the the properties altogether as they just add noise and hide the fact that you can just replace the complete record, but not just parts of it, as you desire. program Project1; uses System.SysUtils, System.Types; type TMyObject = class(TObject) strict private var _PropField: TRectF; public property PropField: TRectF read _PropField write _PropField; public var VarField: TRectF; end; var myObject: TMyObject; begin myObject := TMyObject.Create(); myObject.VarField.Left := 12.0; myObject.PropField.Left := 12.0; // E2064 LEft side cannot be assigned to end. -
Somehow reminds me of this... Source: xkcd: Troubleshooting Sorry for not being helpful. Sometimes, it really is a mess. Even the IDE itself sometimes manages to display modal windows behind itself and the only thing left for me to do is entirely kill it and start fresh.
-
json Trouble getting JSON FindValue (JSONPath) to work
Der schöne Günther replied to omnibrain's topic in Network, Cloud and Web
Not that I know. Here is another example System.JSON.Builders.TJSONIterator.Find - RAD Studio API Documentation (embarcadero.com) Maybe I just forgot $., was glad it worked, and then moved on. 🙃 -
json Trouble getting JSON FindValue (JSONPath) to work
Der schöne Günther replied to omnibrain's topic in Network, Cloud and Web
Take at the look at the documentation again, it has some examples. Get Rid of the $ and the dot. program Project1; uses System.SysUtils, System.JSON; begin var myjson:=TJSONObject.ParseJSONValue('{"name": "Chris","value": 10000}'); var myval:=myjson.FindValue('name'); Assert(myVal.Value() = 'Chris'); end. Or here, with arrays: program Project1; uses System.SysUtils, System.JSON; const json = '{'+ ' "name": "Chris",'+ ' "pets": ['+ ' {'+ ' "name": "Rufus",'+ ' "type": "dog",'+ ' "age": 10'+ ' },'+ ' {'+ ' "name": "Wraabargl",'+ ' "type": "Dinosaur",'+ ' "age": 113'+ ' }'+ ' ]'+ '}'; begin var myjson:=TJSONObject.ParseJSONValue(json); var myval:=myjson.FindValue('pets[1].type'); Assert(myVal.Value() = 'Dinosaur'); readln; end. -
Without more context, it's impossible to say what is wrong in your case. I was very pleasantly surprised when I updated on of our XE7 applications to 10.4 in order to support High DPI. It took me a few days, but everything seemed logical (I had to make a few small changes where the UI used a hard coded number of pixels) - And in the end, it turned out to be great.
-
Newly released book: Delphi Legacy Projects
Der schöne Günther replied to Bill Meyer's topic in Tips / Blogs / Tutorials / Videos
Same here. I can hardly see myself buying a textbook on paper ever again. Also, don't forget syncing your position. I really like to read something on my computer, or Kindle, and half a day later, I can continue reading on my phone, exactly where I left off. -
Its homepage has a lot of encoding errors (at least in my language), I don't remember when I last saw pictures of CD ROMs on web pages and the text advertises it to be compatible with Delphi 7 and Delphi 2006. Go figure. Delphi comes with FireDAC memory tables that support SQL. Local SQL (FireDAC) - RAD Studio (embarcadero.com) Delphi 10.2: Using Local SQL with Firedac Memory Tables - Stack Overflow
-
The voice recognition capabilities of SAPI are horrible, compared with what other technologies offer today. I'm sure it was fine when it was last updated 15 years ago, but as of today, it fails to even meet the most humble expectations.
-
Enable continuous dictation - Windows apps | Microsoft Docs Delphi How To Use Microsoft Speech Recognition API - Stack Overflow
-
Newly released book: Delphi Legacy Projects
Der schöne Günther replied to Bill Meyer's topic in Tips / Blogs / Tutorials / Videos
Amazon in my country lists it as "Currently not available, unknown when it will be". 😐 Please consider at least some kind of PDF. Kindle, however, would be much appreciated. It's just so incredibly comfortable, and other coding books have this option as well. -
Do you need an ARM64 compiler for Windows?
Der schöne Günther replied to Lars Fosdal's topic in Cross-platform
I have lost track for how many times Microsoft has tried to push Windows on ARM, advertised something great, but in the end, nothing of importance happened. It's not that I have anything against Windows on ARM, but if I want a good ARM based computer, I'm getting a M1 Mac. So, do I need an Windows/ARM64 compiler for RAD Studio? No. Embarcadero should rather focus on core functionality and the many platforms we already have. We don't need another one. -
pageControl
Der schöne Günther replied to abdellahmehdi's topic in Algorithms, Data Structures and Class Design
Vcl.ComCtrls.TTabSheet.TabVisible - RAD Studio API Documentation (embarcadero.com) -
A year or two ago, I used NPOI (.NET) for exporting to an excel sheet with formulas and different formats. It was a breeze NuGet Gallery | NPOI 2.5.6 nissl-lab/npoi: a .NET library that can read/write Office formats without Microsoft Office installed. No COM+, no interop. (github.com) Free, widely used, but not in Delphi. You'd have to go with .NET and include that in your Delphi app.
-
Rounded polygon
Der schöne Günther replied to A.M. Hoornweg's topic in Algorithms, Data Structures and Class Design
Bézier curve - Wikipedia -
TIP for Creating PDF Files from HTML / Image
Der schöne Günther replied to microtronx's topic in RTL and Delphi Object Pascal
Not sure where you got that from, browsers can do that perfectly fine. Here is an example with TEdgeBrowser and no additional libraries in Delphi: Printed, for example, in landscape orientation: -
TortoiseGit with Delphi 10 Seattle
Der schöne Günther replied to karl Jonson's topic in General Help
TortoiseGit is not Git! Quote from the official documentation:- 10 replies
-
TIP for Creating PDF Files from HTML / Image
Der schöne Günther replied to microtronx's topic in RTL and Delphi Object Pascal
WebView2 (used by TEdgeBrowser) can directly print to PDF, just saying.