Jump to content

Der schöne Günther

  • Content Count

  • Joined

  • Last visited

  • Days Won


Der schöne Günther last won the day on December 14 2019

Der schöne Günther had the most liked content!

Community Reputation

41 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.0 Seattle

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I haven't done any benchmarks and don't know how much memory usage is a concern in your case- But I would assume that Creating a new list (you already know the capacity) Adding only the needed items Let your variable/field point to the new list could be a valid option.
  2. Der schöne Günther

    [Spring4D] Remove collection elements

    Personally, I like to store those things in a local variable as it makes it easier to debug, but that's probably just personal taste.
  3. Der schöne Günther

    [Spring4D] Remove collection elements

    I would do it like this: procedure p(); var itemsToDelete: IEnumerable<TFoo>; begin itemsToDelete := List.Where(valueIsSmallerThan100); List.RemoveRange(itemsToDelete); end; function valueIsSmallerThan100(const item: TFoo): boolean; begin Result := (item.getValue < 100); end;
  4. Der schöne Günther

    Overload methods or use unique names?

    Also, maybe I'm a bit of an extremist, but I loathe default parameters. I think Delphi still has that bug where you can't serialize a TDictionary<X, Y> because RTTI looks up a parameterless constructor, but the constructor of the TDictionary actually is something like "Create(OwnsObjects: Boolean = False)" which is not the same and the constructor never gets called and you end up with an object in a zombie state. Coding guides like MISRA/AUTOSAR (M8-3-1), HIC++ (Kap. 9.1.2) or even Google agree on default parameters.
  5. Der schöne Günther

    Overload methods or use unique names?

    Refrain from methods with half a dozen parameters, that's just not readable anymore. https://sourcemaking.com/refactoring/smells/long-parameter-list Use a parameter object, and make the values nullable/optional. Then you don't even have overloads for your method anymore. And validation can happen in the scope of your argument object. Like this: type TMethodArgument = record action: TTaskAction; task: TTask; schedule: Nullable<TDateTime>; isQueueOnly: Boolean; hasImmediateExecution: Boolean; class function Default(): TMethodArgument; static; function getIsValid(): Boolean; end; procedure TMyClass.someMethod(const arg: TMethodArgument); begin if (not arg.isValid()) then raise EArgumentException.Create(..); // your stuff here... end;
  6. Der schöne Günther

    [legal] Need help with Packet Sniffer in Delphi

    I'm not able to find anything in that regard over at delphipraxis.net, and the only thing I can find here is
  7. Der schöne Günther

    10.3.2 - FMX on Windows 10 Tablets with virtual keyboard

    The sourcecode from FMX.Platform.Win.pas (at least in 10.0 Seattle) does it all by itself and just launches "osk.exe" which is the keyboard from your second picture. The first one ("tabtip.exe") can (and as I believe, should) be launched instead. Here is an example: https://www.delphipraxis.net/186239-win-8-bzw-10-touch-tastatur-aufrufen.html#post1312405 Here is another but (not Delphi): https://github.com/AlexeiScherbakov/osklib I see that TVirtualKeyboardWin.Create() in Fmx.Platform.Win.Pas may use hardcoded paths to "osk.exe", but there is also a global variable "VirtualKeyboardWin". I think you should be able to subclass TVirtualKeyboardWin to use "tabtip" instead. And thenm let the global variable point to an instance of your subclass.
  8. Der schöne Günther

    10.3.2 - FMX on Windows 10 Tablets with virtual keyboard

    The second one ("OSK") is a legacy keyboard while the first one ("tabtip") is the one that should be used, in my opinion. Normally, Windows will invoke the keyboard when clicking/tapping text boxes with a finger (or pen, when configured). With FMX, it's still painted internally and not a "true" windows edit field with a HWND, right? I see FMX does its own thing in TVirtualKeyboardWin.Create (FMX.Platform.Win.pas), so you can probably use the global variable "VirtualKeyboardWin" and stuff in an implemtation that does not use the hardcoded path to "osk.exe".
  9. Der schöne Günther

    New TForm - Defaults

    Always have a base class for your forms/frames. When adding a new form/frame to your project, do not inherit from TForm/TFrame, inherit from TMyForm/TMyFrame.
  10. Der schöne Günther

    Keyboard Covers the Focused Controls

    I believe what you do is what Embarcadero actually recommends: http://docwiki.embarcadero.com/CodeExamples/Rio/en/FMX.ScrollableForm_Sample
  11. Der schöne Günther

    Arab in iOS

    I haven't been doing anything with FireMonkey for a few years now, but maybe the TLabel on Android is a native component and the operating system handles the text while on iOS, it's basically a FireMonkey paintbox that does not support RTL text?
  12. Der schöne Günther

    Forgot IDE add-on

    Are you certain this was for BitBtn and stuff? I have seen it with TImageList, and it's from CnWizards
  13. Der schöne Günther

    Changes in Parallel Library

    Good to know, thank you both. Sad to hear nobody really believes in Delphis PPL. Our main product has a weird mix of OmniThreadLibrary and Delphis PPL, I think if we ever upgrade beyond 10.0 Seattle, then we should probably get rid of Delphis PPL as well... 😒
  14. Der schöne Günther

    Changes in Parallel Library

    https://quality.embarcadero.com/browse/RSP-23466 reports that OmniThreadLibrary is also affected. Can somebody confirm that?
  15. Still doesn't help you for something like this: procedure p(x,y: Byte); begin if (y = 0) then raise EArgumentOutOfRangeException.Create( NameOf(y) + ' must not be zero'); (...) end;