-
Content Count
267 -
Joined
-
Last visited
-
Days Won
2
Posts posted by Jacek Laskowski
-
-
33 minutes ago, David Heffernan said:Dude, it was you that wanted to have the worker thread notify the main thread! That's literally what you asked in the OP.
There is a big difference between notifying the main thread about the event and calling the drawing method in the main thread (from working thread). In the first case I can decide what I will do, I can even do nothing, in the second case drawing will ALWAYS be forced.
-
4 hours ago, David Heffernan said:You'd have to post the message to the parent. But why bother. Just use TThread.Queue.
Calling Queue from the thread is a bad idea here. There are several threads, each of them processes some data, and one visual control displays them. If each thread is forcing a refresh, it will be a heavy load. And if the light gets messages, even from a few threads, it will decide how to refresh itself.
ps. How to handle the message the parent got? I don't know who the parent will be?
-
6 hours ago, Vincent Parrett said:Or avoid Synchronize and send custom message to the control using PostMessage(control.handle,...) and call invalidate in the message handler.
Thanks, this idea seems interesting to me, because it focuses drawing in one place (several threads can add data). But there is a problem. The control inheriting from TPaintBox does not have Handle.
How to get around it?
-
On 5/20/2020 at 9:19 PM, Attila Kovacs said:you have to edit VTV sources and before every DrawText(W) do a
DrawFormat := DrawFormat or DT_EXPANDTABS or DT_TABSTOPS;
DrawFormat := DrawFormat or (FTabwidth shl 8);
and you can create a property of FTabwidth, (plus one for Expandtabs yes/no).
Thanks, this works!
-
Is possible to send message to PaintBox?
PaintBox inherits from TGraphicControl:
TGraphicControl = class(TControl) private FCanvas: TCanvas; procedure WMPaint(var Message: TWMPaint); message WM_PAINT; protected procedure Paint; virtual; property Canvas: TCanvas read FCanvas; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end;
As can be seen TGraphicControl receives a WM_PAINT message. But how to send it? Where to get the handle for the control? I need to notify the TPaintBox control of the need to repain from the worker thread.
-
Thanks, but this solution not working with VTV. Possibly VTV not support change this parameter.
-
-
@Dany Marmur When you click on the picture, a larger version opens.
But the main question in this post is whether DBGrid is able to show combo with data in the cached lookup field?When the lookup field is constructed traditionally, with a dictionary dataset, then of course the combo list in DBGrid is not empty.
-
I try this trick, it working, but I can't get values in lookup list of dbgrid. It's is impossible? What I'm doing wrong?
-
8 minutes ago, Pierre le Riche said:Yes, the CFastMM_StackTraceEntryCount constant. If there is a big demand for it I could make it adjustable, but v5 is already approaching double the number of entries of v4 so I reckon it should be sufficient.
I've got a callstack in FastMM4 set to 25, because that's the value that didn't cut off my log.
-
3 minutes ago, Pierre le Riche said:The default values are 19 entries under 32-bit, and 20 entries under 64-bit. (The odd numbers are to ensure that the structure is a multiple of 64 bytes.)
The values are adjustable, but not runtime.
Adjustable with source change?
-
I know that, but changing sources to imho is not a configuration 🙂
It should be in the file FastMM4Options.inc -
How deep is the call stack in FastMM5 reports? In FastMM4 it was hardcoded to 11, I reported an issue to add a depth setting option, but it was not added.
-
-
27 minutes ago, Fred Ahrens said:My brain would detect this as an error while reading the code. I always expect to see in the source code the characters I did type and not the characters the IDE "thinks" might look better.
Try to work with JS in the VSC editor, you will quickly change your mind.
- 1
-
1 minute ago, Stefan Glienke said:As far as I know the editor control does not support ligatures
It just handles, only in specific situations, so I asked if it could be switched on permanently.
I discovered it by accident, it only works if the text is a commentary and only if there is some unicode character pasted in the same line, here unicode ENVELOPE.
-
-
Is it possible to enable full ligature support in Delphi code editor?
-
Which drive? The system one in vm? The network one from the host? And how do you disable the cache?
-
I'm working with Delphi on a VMware machine, where I have a disk (with sources) connected from the host via "Folders sharing" mechanism. It's not too fast, but it usually works well.
Sometimes Delphi can slow down a lot, e.g. I click the dot after the name of an object and wait a long time for a list of methods. So I fired a process manager called Process Hacker. And I watched what happens when Delphi "hangs and thinks".
Here's the PH screenshot:It turned out that during the hanging, the I/O rate increases very much. But the Disk and Network ratios are not increasing. What could this I/O be?
-
I can't find a link to the FastMM4Options.inc file. Is FastMM5 no longer a configuration file?
-
In fact, when I'm not debuging, there is no leak.
But is it an IDE error to show the record array (without the record expansion plus) in a hint debugger? Because I was afraid it was a problem in my record and array memory management. I do some tricks there. -
Simple example:
program leak; {$APPTYPE CONSOLE} {$R *.res} uses FastMM4, System.SysUtils; type TRx = record s : string; v : Variant; end; TAx = TArray<TRx>; procedure Test; var lA : TAx; begin SetLength(lA, 3); lA[0].s := 'test2'; lA[0].v := 888; lA[1].s := 'test1'; lA[1].v := Now; lA[2].s := 'test3'; lA[2].v := 'str'; end; begin try Test; except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; end.
When I don't assign TDateTime to a Variant field, the debugger shows the array and all records correctly, as in the picture on the left. And there is no leakage.
But when I assign TDateTime type to Variant field, as on the right side of the picture, the debugger does not show "plus" in hint window and I get a memory leak at the end.
What is wrong with this code?
-
@Remy Lebeau I cannot use this constraint because it blocks the use of string types (because it is not a valuable type).
TPainBox, Handle and PostMessage()
in VCL
Posted
Okay, I didn't know that Invalidate() would send a separate wm_paint message. It changes a lot.
Sending a message from the work thread to the main one was an idea to communicate with the main thread, one of the possible ones. But actually the timer will be better. The data is already written to the appropriate structure, and it is enough to read and draw it periodically.
Thank you all for your comments.