-
Content Count
2946 -
Joined
-
Last visited
-
Days Won
166
Everything posted by Anders Melander
-
I think Cristian is on 11.3 If someone else, other than me (where it works), could check with 12.2 it would be great.
-
Strange. Works for me. Also with 150% What I am seeing though (with 11.3 only), is that if I drop the list by clicking on the left half of the dropdown arrow, and then close the list with another click, then the open dialog is invoked. Dropping the list with a click on the right half works as expected.
-
I just tried with 11.3 and it works exactly the same. Maybe I'm just not understanding what problem your are experiencing. I'm on Windows 10, BTW.
-
I'm curious; What's the purpose then?
-
Works for me with Delphi 12.1 at 175%
-
No comments on why it shrinks but I don't think your Sleep(100) does what you think they do. Your main thread isn't doing anything while the Sleep executes so if the purpose was to let it process the messages generated by mouse_event then you will have to do that some other way. Application.ProcessMessages *shudder* comes to mind.
-
The BEST template engine for generating webpages on the server side?
Anders Melander replied to Edwin Yip's topic in Tips / Blogs / Tutorials / Videos
Why apologize when you are doing it on purpose? -
Is your form modal? If not, do you have a TAction on the mainform with the shortcut [Del] ? KeyPreview is a property on the form. Unless you are intercepting keystrokes on the form there is no reason to have KeyPreview=True. If you need KeyPreview=True then the problem might be that your event handler eats the [Del] key. Show us your code.
-
Watch me coding in Delphi on YouTube
Anders Melander replied to silvercoder79's topic in Tips / Blogs / Tutorials / Videos
That depends on the brain; Some people prefer to read and some prefer to watch a video. I also think it depends on the subject. Highly technical topics, reference material, and so on, are better in writing because we need them to be precise and unambiguous. But video is fine for entry level stuff and conceptual material. I know that very few of our end-users ever read the documentation (they never notice when it falls behind) but the how-to videos get quite a lot of views and feedback. -
No, don't do that; It would accumulate the various errors there is in coordinate system conversion, mouse imprecision, etc. Also, the example just doesn't work. Instead remember the starting mouse position and adjust the scrollbar position with the difference between the starting mouse position and the current position: type TForm1 = class(TForm) [...] private FStartPos: TPoint; end; procedure TForm1.Image1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin FStartPos.X := X; FStartPos.Y := Y; end; procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var DeltaMouse: TPoint; begin if (ssLeft in Shift) then begin // How much has the mouse moved since we started the drag? DeltaMouse := Point(FStartPos.X - X, FStartPos.Y - Y); // Reposition scrollbars (i.e. pan the image) ScrollBox1.HorzScrollBar.Position := ScrollBox1.HorzScrollBar.Position + DeltaMouse.X; ScrollBox1.VertScrollBar.Position := ScrollBox1.VertScrollBar.Position + DeltaMouse.Y; end; end;
-
Memory access problem when exchanging WideString in OLE object written in Delphi
Anders Melander replied to kihor's topic in Windows API
Not that it matter much but it isn't necessary to use a dispatch property to return the value. Apart from that I agree with your implementation. -
Memory access problem when exchanging WideString in OLE object written in Delphi
Anders Melander replied to kihor's topic in Windows API
Um... You asked "Shouldn't the calling convention for an automation object be safecall" which to me reads as "the calling convention for an automation object must be safecall". Or was there another reason you mentioned safecall...? -
When will we have a 64-bit IDE version ?
Anders Melander replied to luciano_f's topic in Delphi IDE and APIs
It isn't. I haven't installed it, but I can read. -
Memory access problem when exchanging WideString in OLE object written in Delphi
Anders Melander replied to kihor's topic in Windows API
I think your COM declarations are incorrect. For a method returning a WideString I would have expected something like this: HRESULT _stdcall GetStringValue([out, retval] BSTR* Result); Note that the result is a HResult so I can use safecall; Do yourself a big favor and use that instead of stdcall. So you need to specify that the string: Is being returned from the method Is the function return value (mostly for use by VB and such). And the Delphi implementation will then look like this: function TMyCOM.GetStringValue(out _Result: WideString): HRESULT; stdcall; begin _Result := 'Hello world'; Result := S_OK; end; or this: function TMyCOM.GetStringValue: WideString; safecall; begin Result := 'Hello world'; end; Delphi is actually excellent for writing COM servers and clients. You just need to learn the basics - and if you will be doing a lot of COM (or just a lot of Windows development), learn the low level stuff too. -
Memory access problem when exchanging WideString in OLE object written in Delphi
Anders Melander replied to kihor's topic in Windows API
safecall is a Delphi concept not a COM concept and safecall just "wraps" stdcall. On the server side safecall traps exceptions and convert them to HRESULT error codes and on the client side it convert HRESULT back to exceptions (for error code only, of course). In order for a method to be declared safecall the underlying COM method must return a HRESULT. Thus: procedure HelloWorld(Value: WORD); safecall; is the same as function HelloWorld(Value: WORD): HResult; stdcall; Here endeth the lesson. -
bug Delphi (Win32) quiets signaling NaN on function return
Anders Melander replied to Jim McKeeth's topic in RTL and Delphi Object Pascal
https://developercommunity.visualstudio.com/t/signaling-nan-float-double-becomes-quiet-nan-when/903305#T-N1065496 https://stackoverflow.com/questions/22816095/signalling-nan-was-corrupted-when-returning-from-x86-function-flds-fstps-of-x87 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57484 So apparently this is just the way things are on x86. -
There seems to be a pretty big gap between your knowledge and your ambitions and you shouldn't really be trying to make custom components (or whatever it was you did) if you haven't learned about things like polymorphism and scope. I suggest you start with something more basic.
-
SetText is declared private in the TControl base class so you don't have access to it. SetText is not declared virtual so you cannot override it. My guess is that you instead need to handle the WM_SETTEXT message.
-
Quality Portal going to be moved
Anders Melander replied to Uwe Raabe's topic in Community Management
Also known as "polishing a turd" 🙂 I haven't looked at it but I doubt that the JSM REST API provides more data or functionality than what the current UI already provide. -
TParallelArray Sort Performance...
Anders Melander replied to Steve Maughan's topic in RTL and Delphi Object Pascal
Impressive. -
TParallelArray Sort Performance...
Anders Melander replied to Steve Maughan's topic in RTL and Delphi Object Pascal
Wouldn't it make sense to do a CLFLUSH before the sort so it doesn't benefit from all the data already being in the cache? procedure FlushCache(Data: Pointer; Size: Integer); const CACHE_LINE_SIZE = 64; asm @NextBlock: CLFLUSH [Data + Size] SUB Size,CACHE_LINE_SIZE JGE @NextBlock end; -
Delphi takes 9 seconds to start/shutdown an empty application
Anders Melander replied to FreeDelphiPascal's topic in General Help
So get a new MB that support the CPU you'd like. In my current system I have upgraded the MB in my system 3 times, the CPU 6 times, the GPU 2 times and the PSU 2 times. Always with newer and faster models. The only thing I haven't replaced is the 20 year old case (Lian Li PC-2100B tower) but that too will go the next time. I don't really need 12 internal and 6 external storage bays anymore 🙂 and being full aluminum it's quite noisy with all the fans. Probably Windows Update. That's a repeat offender on my system. -
TParallelArray Sort Performance...
Anders Melander replied to Steve Maughan's topic in RTL and Delphi Object Pascal
But it crashed faster and fast is better, right? Right? If only there was some easy way of getting stuff like this tested before release... I mean, come on, we all make bugs but this is simply not acceptable. -
TParallelArray Sort Performance...
Anders Melander replied to Steve Maughan's topic in RTL and Delphi Object Pascal
How do you get the benchmark results ordered by parameters rather than method? The way I use spring.benchmark I get the results ordered by method and then parameters which makes it hard to compare the different methods: procedure Benchmark(BenchmarkFunc: TFunction; const Name: string); begin Spring.Benchmark.Benchmark(BenchmarkFunc, Name).RangeMultiplier(4).Ranges([Range(1024+1, 8192+13), Range(128, 5120)]).TimeUnit(kMillisecond); end; //------------------------------------------------------------------------------ begin Benchmark(BenchmarkNoTranspose32, 'MemCopy (no transpose)'); Benchmark(BenchmarkReferenceTranspose32, 'ReferenceTranspose32'); Benchmark(BenchmarkCacheObliviousTranspose32, 'CacheObliviousTranspose32'); Benchmark(BenchmarkCacheObliviousTransposeEx32, 'CacheObliviousTransposeEx32'); Benchmark(BenchmarkSuperDuperTranspose32, 'SuperDuperTranspose32'); Spring.Benchmark.Benchmark_Main; end. ------------------------------------------------------------------------------------------------ Benchmark Time CPU Iterations UserCounters... ------------------------------------------------------------------------------------------------ MemCopy (no transpose)/1025/128 0,028 ms 0,025 ms 26353 Rate=5.26859G/s MemCopy (no transpose)/4096/128 0,153 ms 0,143 ms 4480 Rate=3.66644G/s MemCopy (no transpose)/8205/128 0,616 ms 0,578 ms 1000 Rate=1.81663G/s MemCopy (no transpose)/1025/256 0,064 ms 0,049 ms 11200 Rate=5.37395G/s MemCopy (no transpose)/4096/256 0,596 ms 0,502 ms 1120 Rate=2.08783G/s MemCopy (no transpose)/8205/256 1,30 ms 1,03 ms 560 Rate=2.03463G/s MemCopy (no transpose)/1025/1024 0,590 ms 0,558 ms 1120 Rate=1.88088G/s MemCopy (no transpose)/4096/1024 2,56 ms 2,25 ms 299 Rate=1.86656G/s MemCopy (no transpose)/8205/1024 5,48 ms 4,26 ms 154 Rate=1.97165G/s MemCopy (no transpose)/1025/4096 2,63 ms 2,08 ms 345 Rate=2.01523G/s MemCopy (no transpose)/4096/4096 10,9 ms 10,0 ms 64 Rate=1.67608G/s MemCopy (no transpose)/8205/4096 23,6 ms 22,6 ms 29 Rate=1.48514G/s MemCopy (no transpose)/1025/5120 3,36 ms 2,85 ms 236 Rate=1.84339G/s MemCopy (no transpose)/4096/5120 14,3 ms 12,3 ms 56 Rate=1.70823G/s MemCopy (no transpose)/8205/5120 29,3 ms 23,8 ms 21 Rate=1.7644G/s ReferenceTranspose32/1025/128 0,345 ms 0,322 ms 2036 Rate=407.045M/s ReferenceTranspose32/4096/128 1,49 ms 1,35 ms 498 Rate=388.607M/s ReferenceTranspose32/8205/128 3,84 ms 3,07 ms 224 Rate=342.187M/s ReferenceTranspose32/1025/256 0,806 ms 0,628 ms 1120 Rate=417.974M/s ReferenceTranspose32/4096/256 3,91 ms 3,23 ms 213 Rate=324.868M/s ReferenceTranspose32/8205/256 28,4 ms 25,7 ms 28 Rate=81.8274M/s ReferenceTranspose32/1025/1024 7,00 ms 6,77 ms 90 Rate=155.018M/s ReferenceTranspose32/4096/1024 97,6 ms 93,8 ms 7 Rate=44.7392M/s ReferenceTranspose32/8205/1024 184 ms 168 ms 4 Rate=50.0207M/s ReferenceTranspose32/1025/4096 33,4 ms 32,8 ms 20 Rate=127.951M/s ReferenceTranspose32/4096/4096 367 ms 336 ms 2 Rate=49.9415M/s ReferenceTranspose32/8205/4096 720 ms 656 ms 1 Rate=51.2117M/s ReferenceTranspose32/1025/5120 44,2 ms 41,4 ms 17 Rate=126.885M/s ReferenceTranspose32/4096/5120 459 ms 391 ms 2 Rate=53.6871M/s ReferenceTranspose32/8205/5120 969 ms 781 ms 1 Rate=53.7723M/s CacheObliviousTranspose32/1025/128 0,326 ms 0,285 ms 2800 Rate=461.001M/s CacheObliviousTranspose32/4096/128 1,37 ms 1,34 ms 560 Rate=391.468M/s [...] -
Delphi takes 9 seconds to start/shutdown an empty application
Anders Melander replied to FreeDelphiPascal's topic in General Help
The CPU alone would be enough to explain the difference. I'm guessing your old CPU was a AMD Ryzen 8700G which is 5-6 times faster than your new CPU. https://www.cpubenchmark.net/compare/2962vs5836/Intel-i5-7440HQ-vs-AMD-Ryzen-7-8700G In addition, the support circuits (all the stuff that's not the CPU), being laptop components, are most likely optimized for energy efficiency rather than performance. My own laptop, a Lenovo X1 Extreme, was at the time I bought it the fastest (and most expensive 😞 ) laptop Lenovo produced but the performance is still... meh.. not impressive. The RAM will also make a difference. Windows 10 will be able to handle 16Gb better than Windows 7 did but it's still on the lower side. I think the best thing you could do with this hardware is to add more memory. Depending on the current memory configuration you should be able to upgrade to 32Gb. If I was you I would spend my effort on fixing your old system. Replace the parts that are dead. If you limit yourself to parts (CPU/MB/RAM/GPU) that are a few years old you can build a really good system on the cheap. I reluctantly upgraded my main system from Windows 7 to 10 earlier this year. I had feared that it would kill the performance of my 10+ old system (Intel i5-2500K @ 3.30Ghz, 16Gb) but it actually performs pretty good. In many cases better than the old system did.