-
Content Count
2667 -
Joined
-
Last visited
-
Days Won
142
Anders Melander last won the day on February 20
Anders Melander had the most liked content!
Community Reputation
1892 ExcellentTechnical Information
-
Delphi-Version
Delphi 12 Athens
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Default() and subrange types
Anders Melander replied to Der schöne Günther's topic in RTL and Delphi Object Pascal
Don't expect it to be "fixed". The best you can hope for is that it is documented. The current behavior is consistent with class initialization; If you have the same field in a class and create a new instance, then the ordinal value of the field will be zero - as expected. -
Bummer. I've just checked both my desktop (which is a *ehem* 15 years old home build) and my laptop which is the top Lenovo X1 model, 2 years old, and neither of them support S0. This means that I unfortunately can't help debug the problem. If anyone else wants to have a go at it, the command to check for S0 support is powercfg /a. Note though that if Modern Standby isn't already enabled then it requires a complete OS reinstall to enable it. Yup, you read that right. Nice one, Microsoft.
-
You are looking at the symptoms at the end of a long chain of circumstances. You need to look at the other end, which supposedly (assuming WM_TIMER is the problem) is closer to the source of the problem. If standby killed WM_TIMER then millions of applications would break so I think it's very unlikely. The bug in PuTTY wasn't that the timer didn't fire but that they assumed that it would fire with a certain time interval and WM_TIMER is never guaranteed to do that. AFAIK WM_TIMER is a low priority message which is only synthesized when the message queue is polled and no higher priority messages are in the queue (or synthesized). I don't know your application but it could be that the queue is simply flooded with other stuff after resume from standby. So instead of assuming that WM_TIMER doesn't work I recommend that you simply verify with a simple application that does nothing but write a time stamp to a TMemo every time a 1 second TTimer fires. If that doesn't work then there's a problem with TTimer and we can start examining what that is.
-
I think the timer is still alive. It just takes a (unusually long) while to fire after resume from standby. See also: https://github.com/cyd01/KiTTY/issues/475
-
VCL UI Design Challenge for Delphi Developers 💡
Anders Melander replied to bravesofts's topic in VCL
Why? In a browser? -
Multithread and thread-safe TClientDataSet?
Anders Melander replied to snodev's topic in RTL and Delphi Object Pascal
Yes. I think you should drop the idea of the workers writing to a dataset. Write to a lock free queue instead and then read from the queue from a separate thread.- 5 replies
-
- delphi
- tclientdataset
-
(and 1 more)
Tagged with:
-
Multithread and thread-safe TClientDataSet?
Anders Melander replied to snodev's topic in RTL and Delphi Object Pascal
If by "clone" you mean a cursor clone, then the master and the clone shares the same data and modification from one thread will alter data seen by other threads (with no automatic synchronization AFAIR). So: Not thread safe. If by "clone" you mean a distinct private copy of the data, then yes it's safe. Apart from that, do you have a specific reason to use TClientDataSet instead of TFDMemTable? TFDMemTable also has clonable cursors (with pretty much the same restrictions as TClientDataSet I would think). With TFDMemTable you at least have the source and can see for yourself what goes on.- 5 replies
-
- delphi
- tclientdataset
-
(and 1 more)
Tagged with:
-
Yeah well, threads do come with their own challenges and I have a feeling that the OP "just want it work" and get on with business. I agree that blocking the main thread for 5 seconds is too long - and I'm pretty sure Windows isn't too happy about it either.
- 24 replies
-
- rad studio 11
- delphi
-
(and 1 more)
Tagged with:
-
I can't believe I just made a case for Application.ProcessMessages after 25 years of trying to get people to stop using it 🤦♂️
- 24 replies
-
- rad studio 11
- delphi
-
(and 1 more)
Tagged with:
-
The purpose of Application.ProcessMessages would be to have any pending messages in the queue processed. If there is a mouse-click message in the queue then it will be processed but will do nothing because the control being clicked is disabled. Without Application.ProcessMessages then the mouse-click message will still be in the queue after the control has been enabled and will therefore be handled as a click when the queue is pumped.
- 24 replies
-
- rad studio 11
- delphi
-
(and 1 more)
Tagged with:
-
I can't see why. Please explain.
- 24 replies
-
- rad studio 11
- delphi
-
(and 1 more)
Tagged with:
-
I agree wrt avoiding Application.ProcessMessages but... If the form is modal then you can disable the form instead of the panel and then it should be (relatively) safe to use Application.ProcessMessages. Place it right before you enable the form again.
- 24 replies
-
- rad studio 11
- delphi
-
(and 1 more)
Tagged with:
-
Exactly
- 24 replies
-
- rad studio 11
- delphi
-
(and 1 more)
Tagged with:
-
Yes it will. The reason it will not pump messages is that it's not being given an opportunity to do so. This is the equivalent: Button.Enabled := False; Sleep(1000); Button.Enabled := True;
- 24 replies
-
- rad studio 11
- delphi
-
(and 1 more)
Tagged with:
-
That doesn't solve the problem. Read the prior replies. Why test for csAcceptsControls? It's a design-time option.
- 24 replies
-
- rad studio 11
- delphi
-
(and 1 more)
Tagged with: