-
Content Count
1936 -
Joined
-
Last visited
-
Days Won
25
Everything posted by Attila Kovacs
-
IDLIST is an array of integer, why do you want to convert it to a string?
-
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
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! -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
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. -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
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. -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
@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. -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
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. -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
Actually Nullable<Nullable<T>> with a distinction by level between the nulls -
TNothingable<T>
Attila Kovacs replied to Attila Kovacs's topic in Algorithms, Data Structures and Class Design
No, one step above. Nothing / (values incl. null) -
How do you identify bottleneck in Delphi code?
Attila Kovacs replied to Mike Torrettinni's topic in Tips / Blogs / Tutorials / Videos
I think you are doing it very well... -
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!?
-
@KodeZwerg Not bad at all! I'm too tired 😉
-
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?
-
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?)
-
@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.
-
Inch representation format in TEdit like controls
Attila Kovacs replied to Cristian Peța's topic in General Help
Yeah, thx. We found a bug in the RTL/VCL and a better way to communicate. I see no offensive material. -
Inch representation format in TEdit like controls
Attila Kovacs replied to Cristian Peța's topic in General Help
It will be the system default by default. So in my case it's __ __.__ Looks like a bug in MaskEdit -
Inch representation format in TEdit like controls
Attila Kovacs replied to Cristian Peța's topic in General Help
bug -
Inch representation format in TEdit like controls
Attila Kovacs replied to Cristian Peța's topic in General Help
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"? -
Micro optimization: Split strings
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
@Fr0sT.Brutal It won't be compatible with other systems. Also, .Split() accepts Option flags, there could be an IgnoreLastEmpty for that case. -
@balabuev Could you figure it out what is happening there? It's not clear for me based on that workaround.
-
Micro optimization: Split strings
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Yet again? 🙈 -
Micro optimization: Split strings
Attila Kovacs replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
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. -
there is a fat 26% discount on D until 28. Feb, so start testing!!! 😉
-
Sorry, I thought calling destructor TWinControl.Destroy; is equal to destroying a component. my bad
-
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.