Jump to content

Anders Melander

Members
  • Content Count

    2667
  • Joined

  • Last visited

  • Days Won

    142

Everything posted by Anders Melander

  1. Anders Melander

    Default() and subrange types

    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.
  2. Anders Melander

    Modern StandBy

    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.
  3. Anders Melander

    Modern StandBy

    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.
  4. Anders Melander

    Modern StandBy

    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
  5. 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.
  6. 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.
  7. Anders Melander

    Disable all controls on panel

    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.
  8. Anders Melander

    Disable all controls on panel

    I can't believe I just made a case for Application.ProcessMessages after 25 years of trying to get people to stop using it 🤦‍♂️
  9. Anders Melander

    Disable all controls on panel

    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.
  10. Anders Melander

    Disable all controls on panel

    I can't see why. Please explain.
  11. Anders Melander

    Disable all controls on panel

    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.
  12. Anders Melander

    Disable all controls on panel

    Exactly
  13. Anders Melander

    Disable all controls on panel

    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;
  14. Anders Melander

    Disable all controls on panel

    That doesn't solve the problem. Read the prior replies. Why test for csAcceptsControls? It's a design-time option.
  15. Anders Melander

    Disable all controls on panel

    ...not because the panel is disabled but because the stuff in between doesn't process messages - in case you wondered.
  16. Anders Melander

    Disable all controls on panel

    It's because you aren't processing any windows messages while the panel is disabled, so when you enable it again the mouse click message is still waiting in the message queue.
  17. Anders Melander

    TCachedDatasource

    https://meta.wikimedia.org/wiki/Cunningham's_Law
  18. Anders Melander

    TCachedDatasource

    https://docwiki.embarcadero.com/Libraries/Athens/en/Data.DB.TDataSource TDataSource is the wrong layer for something like caching. You need to sit between TDataSource and TDataSet. What happens if you have two datasources connected to a single dataset and one of them modifies the data? Now you have two different views of what the data looks like... What is the point of spawning a thread to update the cache if all the thread does is call Synchronize to update the cache from the main thread? I know ElevateDB has had resistance against FireDAC in the past but if they have gotten wiser, and support FireDAC now, then you could have used one of the FireDAC datasets. They all support caching and briefcase mode. TClientDataSet could also have been used.
  19. Anders Melander

    Docking Example

    23929_tdocktabset_sample_application.ZIP Last time I looked, and it's been a while, the docking manager used in the IDE was a different one from the one in the VCL. The behavior of the VCL docking manager is (was?) hardcoded into TControl in a way that made it impossible to fix from the outside. I would say it depends on the users. I was talking about typical non-technical end-users. Obviously highly technical users, such as developers, have no problems using docking.
  20. Anders Melander

    Docking Example

    I gave up on the VCLs docking a long time ago, after having spent a ridiculous amount of time trying to work around its numerous bugs. It's broken beyond repair and should be deprecated and replaced. I use DevExpress docking now and I think it works really well. That said, from watching our users, and even our in-house supporters, I can tell you that ordinary users don't understand how to use docking at all. It's really painful to watch them trying to get the dock layout they want. So I think it's best to try and limit the range of docking features available to the user. For example: No auto-hide panels, no docked maximize/minimize. Even floating dock panels might be too advanced or simply not usable (undocked forms obscure the windows below) or unnecessary (multi-monitors are being replaced by wide monitors).
  21. Anders Melander

    Does anyone know a delphi component that can play videos from a stream

    Another option is to use DirectShow. I know that can also be made to load from a stream. Google "Delphi DirectShow"
  22. Anders Melander

    Does anyone know a delphi component that can play videos from a stream

    The application is closed source but I have attached the relevant unit (and one dependency). There are a lot of unrelated dependencies in that unit, since it is a part of a large resource editor framework, so unfortunately it's not as readable as it could be. The unit implements a viewer for video and sound media resources. amResourceViewMedia.pas amResourceViewMedia.dfm VFW.pas
  23. Anders Melander

    Does anyone know a delphi component that can play videos from a stream

    I have some code that I use in my resource editor to display video from a memory stream, so it's definitely possible. I just looked and it's about 500-600 lines of code and involves a custom I/O handler among other horrors. Here's a screenshot: And here's a video: Hmm. Never mind with the video. I can't figure out how to create a video this forum supports.
  24. Anders Melander

    Enable Discussions on github ?

    One thing you can do, to direct activity to the discussions, is to convert issues to discussion unless they actually pertain to an acknowledged bug or an accepted change/feature/enhancement. That way the issue list becomes a list of work items and the discussions everything else.
×