Jump to content

Der schöne Günther

Members
  • Content Count

    655
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by Der schöne Günther

  1. Der schöne Günther

    Left side cannot be assigned to

    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.
  2. Der schöne Günther

    RDP and RD Web deployment of Delphi VCL apps

    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.
  3. Der schöne Günther

    Trouble getting JSON FindValue (JSONPath) to work

    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. 🙃
  4. Der schöne Günther

    Trouble getting JSON FindValue (JSONPath) to work

    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.
  5. Der schöne Günther

    Delphi 11.1 - High DPI

    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.
  6. Der schöne Günther

    Newly released book: Delphi Legacy Projects

    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.
  7. Der schöne Günther

    sqlmemtable

    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
  8. Der schöne Günther

    Windows 11 Speech Recognition

    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.
  9. Der schöne Günther

    Windows 11 Speech Recognition

    Enable continuous dictation - Windows apps | Microsoft Docs Delphi How To Use Microsoft Speech Recognition API - Stack Overflow
  10. Der schöne Günther

    Newly released book: Delphi Legacy Projects

    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.
  11. Der schöne Günther

    Do you need an ARM64 compiler for Windows?

    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.
  12. Der schöne Günther

    pageControl

    Vcl.ComCtrls.TTabSheet.TabVisible - RAD Studio API Documentation (embarcadero.com)
  13. Der schöne Günther

    Working with Delphi and Excel

    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.
  14. Der schöne Günther

    Rounded polygon

    Bézier curve - Wikipedia
  15. Der schöne Günther

    TIP for Creating PDF Files from HTML / Image

    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:
  16. Der schöne Günther

    TortoiseGit with Delphi 10 Seattle

    TortoiseGit is not Git! Quote from the official documentation:
  17. Der schöne Günther

    TIP for Creating PDF Files from HTML / Image

    WebView2 (used by TEdgeBrowser) can directly print to PDF, just saying.
  18. Der schöne Günther

    DUnitX and StackTraces

    Don't want to be a party pooper, but I never saw the reason for having detailed stack traces. Tests should fail for exactly one reason. If you have a bunch of entirely different checks in your test case and struggle to find out what exactly failed, there's something wrong. Better split them up in seperate tests. I am still on DUnit and have never really used DUnitX, but can't you debug a test? That should easily tell you what, and where something is going wrong. The fabulous "Test Insight" plugin from Stefan allows you to directly debug the test at your cursor position with [Alt]+[F9] sglienke / TestInsight / wiki / Home — Bitbucket
  19. Der schöne Günther

    Overloads in implementation

    The reason is that function GetDay(dt: TDateTime) doesn't yet know about the other overload. You either have to replace their order or, better, add a definition like you did when you added their definition in the interface section of the unit.
  20. I have some API that allocates and returns a TArray<Word>. I would then like to process this array with a library that operates exclusively on TArray<Byte>. How can I cast my_word_array to my_byte_array without re-allocating space for a new array and then copying the entire content over? My only idea so far was a clunky workaround using the absolute directive and manually overwriting the array's length indicator in memory: procedure changeLengthIndicator(const firstElement; const newLength: NativeInt); var ptr: PNativeInt; begin // Source regarding memory layout: // https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Internal_Data_Formats_(Delphi)#Dynamic_Array_Types ptr := Addr(firstElement); Dec(ptr); //set pointer to length indicator ptr^ := newLength; end; procedure p(); var words: TArray<Word>; bytes: TArray<Byte> absolute words; byteCount: NativeInt; begin words := [$0FF0, $FEFE, $0000, $0001, $ABAB]; byteCount := Length(words) * SizeOf(Word); changeLengthIndicator(bytes[0], byteCount); processBytes(bytes); end; Is there a better option? Unfortunately, there is no making sure no one will use the words array after the call to changeLengthIndicator(..).
  21. Of course. That's what unit tests are for 😎 True. Or, even better and less c-like, IEnumerable<Byte>
  22. That's actually an interesting idea. It will store if it's in "byte" or "word" mode, and if you're trying to get the "wrong" data, it will instead throw a runtime exception. That's certainly better than what I have right now.
  23. No, using the absolute variable does not increase the array's reference count. See this snippet: Project1.dpr · GitHub
  24. It will overwrite the second half of the existing data with zeroes because it considers it "newly allocated" System.SetLength - RAD Studio API Documentation (embarcadero.com)
  25. Der schöne Günther

    Is TEdit bugged with mobile? Since when?

    That does not sound typical at all. I don't know about Android, but on iOS you can either scroll by swiping on the space key, or by tap and holding within the text area. It is not a problem at all.
×