Jump to content

Attila Kovacs

Members
  • Content Count

    1936
  • Joined

  • Last visited

  • Days Won

    25

Everything posted by Attila Kovacs

  1. Attila Kovacs

    How to get json array from string?

    IDLIST is an array of integer, why do you want to convert it to a string?
  2. Attila Kovacs

    TNothingable<T>

    Ooookay, this conversation brought me to a moment of enlightenment. We were both right, but they are two different things (null/[]) so I will threat them differently, with the same JSONName attribute. This solves everything for now. I can keep my object mapping, which was the most important thing for me. Thx guys!
  3. Attila Kovacs

    TNothingable<T>

    Yes, i did the same, returning TNothing = interface end; in the TValue. I just lost my temper on the structured types and I thought I'm asking if somebody has something similar (and maybe much simpler/better) done.
  4. Attila Kovacs

    TNothingable<T>

    If you are telling me that you can't check a json array in php if it's holding a value of null, just if it's empty, then I'm fine, the above example is wrong. I'm not sure. Bollock what I wrote. It's just a key/value pair. There is no such thing that an array can't be null. This is the problem. Edit: My example above is indeed wrong on arrays. It should have been t.y.SetNull or similar. [] should translate to [], you are right.
  5. Attila Kovacs

    TNothingable<T>

    @Stefan Glienke Please tell this the people who are writing the php API's. I did the same with objects and passed "{}" and the server created the object with default values. @Fritzew A simple webshop php API, but any json API's out there where the values are interpreted individually.
  6. Attila Kovacs

    TNothingable<T>

    as an example: T=type y: TNothingable<TArray<string>>; z: TNothingable<TSomeObject>; end; T.tojson => {} T.y := []; T.y.SetNull; T.tojson => { "y" : null } T.z := nil; T.tojson => { "y": null, "z": null } There are API's where I have to pass null values if I want to clear its content and I also want to keep everything mapped. I'm not willing to map those fields with string literals and build up a json-object.
  7. Attila Kovacs

    TNothingable<T>

    Actually Nullable<Nullable<T>> with a distinction by level between the nulls
  8. Attila Kovacs

    TNothingable<T>

    No, one step above. Nothing / (values incl. null)
  9. Attila Kovacs

    How do you identify bottleneck in Delphi code?

    I think you are doing it very well...
  10. Attila Kovacs

    WM_CHANGEUISTATE

    As the *UISTATE messages are poorly implemented in the VCL, actually it's just a : procedure TWinControl.WndProc(var Message: TMessage); . if Message.Msg = WM_UPDATEUISTATE then Invalidate; // Ensure control is repainted without storing and checking against the actual UI state, nor checking the wparam if it's only a UIS_INITIALIZE, raises the question: For what the heck is this Invalidate there? Because it causes a bunch of flickering on pressing the "alt"-key or on calling InsertControl(). What regression will I have if I'm overriding this message in my common TForm like: procedure ChangeUIState(var Message: TMessage); message WM_CHANGEUISTATE; procedure TCForm.ChangeUIState(var Message: TMessage); begin // do nothing end; except a faster GUI, no flickering, smoother form-parenting!?
  11. Attila Kovacs

    WM_CHANGEUISTATE

    @KodeZwerg Not bad at all! I'm too tired 😉
  12. Attila Kovacs

    WM_CHANGEUISTATE

    Okay, there is no more such setting in W10, but I found something interesting: There seems to be a problem with THEMES support in Delphi, in which TButton, TCheckBox, TRadioButton and TStaticText standard controls vanish in VISTA when the ALT key is pressed. (only TStaticText vanishes in XP). If the OS is set to default, pressing the ALT key in XP and Vista has the behavior of displaying the underline under the accelerator keys. The mentioned controls vanish the first time ALT is pressed. They can be restored by repainting the control in code. Once restored, they are not affected by subsequent ALT key presses -- unless a pagecontrol on the form changes to a new tabsheet, then all affected controls, both on the tabsheet and on the form, will vanish on next ALT press. Due to the pagecontrol issue there is no way to set a flag to do the repaint op only once. In MDI applications, an ALT key press has the same affect on all child forms at the same time ** End quote ************** Looks like it's all because of those bugs in XP and Vista. Now how would it be possible to keep the backward compatibility but not calling Invalidate on > Vista and not checking the OS version in a WndProc?
  13. Attila Kovacs

    TTreeNode leak when VCL styles are active

    I'm not sure whether it's even worth further debugging. I just got an email from quality emba that they are unable to reproduce this: https://quality.embarcadero.com/browse/RSP-20010 and there is also this: https://quality.embarcadero.com/browse/RSP-15109 The whole unit is a mess. (And I don't think they fixed it. Did they? 10.4.2 anyone?)
  14. Attila Kovacs

    WM_CHANGEUISTATE

    @KodeZwerg Hmm, now that you say, I think there is an option somewhere in windows where you can tell if the accelerator keys are by default drawn or only on pressing the alt-key. Maybe. I don't know. Because they are drawn by me all the time (on buttons etc..) and the menus are just working fine without the Invalidate. So I can't find the regressions, otherwise I could debug and implement a proper handling by storing the form's UI state and call Invalidate if needed. Thx.
  15. Attila Kovacs

    Inch representation format in TEdit like controls

    Yeah, thx. We found a bug in the RTL/VCL and a better way to communicate. I see no offensive material.
  16. Attila Kovacs

    Inch representation format in TEdit like controls

    It will be the system default by default. So in my case it's __ __.__ Looks like a bug in MaskEdit
  17. Attila Kovacs

    Inch representation format in TEdit like controls

    There must be a bug in Delphi as "\/" does not make a literal from "/" but instead converts it to the system's date separator. Buhh. Anyway, what if the user just want to enter 12"?
  18. Attila Kovacs

    Micro optimization: Split strings

    @Fr0sT.Brutal It won't be compatible with other systems. Also, .Split() accepts Option flags, there could be an IgnoreLastEmpty for that case.
  19. Attila Kovacs

    TTreeNode leak when VCL styles are active

    @balabuev Could you figure it out what is happening there? It's not clear for me based on that workaround.
  20. Attila Kovacs

    Micro optimization: Split strings

    Yet again? 🙈
  21. Attila Kovacs

    Micro optimization: Split strings

    interesting how Split() interpretations differ: //Delphi RTL sp := 'qq;ww;ee;'.Split([';']); // => ['qq', 'ww', 'ee'] // My test case arr := Split('qq;ww;ee;'); // => ['qq', 'ww', 'ee', ''] This in python and in php returning also ['qq', 'ww', 'ee', ''], and so would I expect.
  22. Attila Kovacs

    Delphi 10.4.2 first impressions

    there is a fat 26% discount on D until 28. Feb, so start testing!!! 😉
  23. Attila Kovacs

    TTreeNode leak when VCL styles are active

    Sorry, I thought calling destructor TWinControl.Destroy; is equal to destroying a component. my bad
  24. Attila Kovacs

    TTreeNode leak when VCL styles are active

    You can achieve the same with two TListView's on the same parent, like a TPanel, both having one node. There is something with FTempItem or I don't know, TSubItems' constructor and destructor is not called the same time (4/3), I have no more time for debugging and I don't want to see this code anymore. I can't believe that on a theme change you have to destroy and create a component 4 times in a row.
×