-
Content Count
2854 -
Joined
-
Last visited
-
Days Won
156
Posts posted by Anders Melander
-
-
6 hours ago, bravesofts said:Post your best attempt below!
Why?
6 hours ago, bravesofts said:Fun fact: The login form shown in the image is actually running on Windows XP!
In a browser?
-
1
-
-
1 minute ago, snodev said:You mean like TClientDataSet.CopyDataSet/TClientDataSet.CopyRecords?
Yes.
1 minute ago, snodev said:I must solve the thread safety before.
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.
-
1
-
-
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.
-
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.
QuoteIf a top-level window stops responding to messages for more than several seconds, the system considers the window to be not responding. In this case, the system hides the window and replaces it with a ghost window that has the same Z order, location, size, and visual attributes.
-
I can't believe I just made a case for Application.ProcessMessages after 25 years of trying to get people to stop using it 🤦♂️
-
2
-
-
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.
-
3 minutes ago, PeaShooter_OMO said:In anyway, the Waitfor will negate Application.ProcessMessages where you put it.
I can't see why. Please explain.
-
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.
-
Just now, PeaShooter_OMO said:as soon as btnWriteASCII_ShrtClick returns the queued messages will be processed.
Exactly
-
3 minutes ago, Cristian Peța said:The OP is disabling only the panel and that will not disable the button.
Yes it will.
3 minutes ago, Cristian Peța said:Angus solution will solve the problem because the function will disable the button that will not pump the windows messages.
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;
-
1
-
1
-
-
1 hour ago, Angus Robertson said:I use this function to disable and reanable all controls in a container
- That doesn't solve the problem. Read the prior replies.
- Why test for csAcceptsControls? It's a design-time option.
-
Just now, Anders Melander said:you aren't processing any windows messages while the panel is disabled,
...not because the panel is disabled but because the stuff in between doesn't process messages - in case you wondered.
-
1 hour ago, @rturas said:If i click on any disabled button while panel is disabled, its event is fired after the panel is reanabled. Is it normal behavior, or am i doing something wrong?
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.
-
1
-
-
21 minutes ago, Ian Branch said:See, I knew alternatives would be suggested.
-
1
-
1
-
-
1 hour ago, Ian Branch said:even if it is as an exercise in how not to do it.
https://docwiki.embarcadero.com/Libraries/Athens/en/Data.DB.TDataSource
QuoteTDataSource provides an interface between a dataset component and data-aware controls on a form.
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.
-
1
-
-
29 minutes ago, pyscripter said:The IDE docking is based on TDockTabSet, which was introduced in Delphi 2005. It has received some attention later including Vcl styling. The only demo I could find is an old one by Jeremy North, but the source code is not available.
23929_tdocktabset_sample_application.ZIP
11 minutes ago, pyscripter said:It is not the sleekest implementation, but apparently it works OK in the IDE.
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.
17 minutes ago, pyscripter said:Agree in general, but it depends on the application.
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.
-
2
-
-
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). -
Another option is to use DirectShow. I know that can also be made to load from a stream.
Google "Delphi DirectShow"
-
6 minutes ago, ToddFrankson said:Do you have it available somewhere so I can at least take a look?
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.
-
1
-
-
4 hours ago, ToddFrankson said:Neither currently allows a stream outside of a server side video.....
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.
-
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.
-
1
-
-
51 minutes ago, Die Holländer said:Is there any way to train an AI model with Remy's brain?
Yes; It's called a tarpit 🙂
-
There's the old TMediaPlayer but AFAIR it's a pain (but possible) to get to work with TStream.
A better alternative would be to import the type library for the Windows Media Player ActiveX and use that.
https://chapmanworld.com/windows-media-player-in-delphi/ -
-
Apparently the standard design-time property editors doesn't fully support Variant.
https://stackoverflow.com/questions/29979950/how-to-correctly-set-a-variant-published-property
I've looked at the code of the property editor but I can't make sense of it so I can't tell if it should work or not. I would have to debug Delphi in Delphi to figure it out and... Nope.
-
Don't compare against a boolean value. Use boolean logic:
if not VarSameValue(FCheckedValue, Value)then
-
Same with the test in IsCheckedValueStored. Just set result directly:
Result := not VarSameValue(FCheckedValue, True);
-
Apparently the standard design-time property editors doesn't fully support Variant.
Modern StandBy
in General Help
Posted
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