It is used inside the TAppliation.Idle to fire the (undocumented) TApplication.DoActionIdle method. When the value is zero or less, then each Idle call will result in an DoActionIdle call in turn calling TCustomForm.UpdateActions for any visible form.
In theory, the OnUpdate method for each action can even be called multiple times (because multiple controls on visible forms can point to it), but the real culprit is that TApplication.Idle as it can be called from these places:
TApplication.DoApplicationIdle
TApplication.HandleMessage (in a loop from TApplication.Run)
TCustomActionMenuBar.ProcessMenuLoop (in a loop)
TCustomRibbon.DisplayKeyTips (in a loop)
The last three (especially HandleMessage) can be disastrous as they can be called a lot (for instance when moving the mouse), and more often than not, the OnUpdate event handlers aren’t exactly CPU friendly.
A while ago I bumped into an application where the OnUpdate event handler for one action was called half a million time in under 5 minutes.
This clearly indicated a huge problem (besides using a full CPU core slowing down the application) as apparently something was broadcasting Windows Messages like crazy.
Investigating and Solving the message flood is on the back-log with a reasonably high priority, but the highest priority issue was fixing the high CPU usage in the first place.
Apparently more users suffer from this, as there is a Vcl.Forms.TApplication.ActionUpdateDelay property which TApplication.Idle uses to call the Windows API function SetTimer to rate-limit the TApplication.DoActionIdle call tree. Luckily SetTimer does have documentation on the unit of ActionUpdateDelay: it’s milliseconds.
I’ve set it to 10 as that updating the actions ~100 times a second is fast enough for this application.
At the time of writing: The Selective Debugging package currently supports Delphi XE to Delphi 10.1 Berlin. It can be downloaded here: SelectiveDebuggingSetup.zip [WayBack]
If when setting up Continuous Integration (CI) with Delphi and you get errors like E2202"Required package 'rtl' not found" or F1027"Unit not found: 'System.pas'", then something is wrong with your library path on the CI server.
Before going into the details of why, the quick solution is to set either of these environment variables in your build script
put your resources in a text RC file that can be compiled through a resource compiler
add these to your Delphi project via the project manager, so it generated RcCompile elements which instructs the build process to run the resource compiler first:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
class function TCardinalHelper.Parse(const S: string): Cardinal;
begin
Result := StrToInt(S);
end;
Which means you get this nice EConvertError with message ''4294967295' is not a valid integer value'. with this simple test (which doesn’t even reach the Assert):
uses
System.SysUtils;
procedure Cardinal_Parse_High_Cardinal_Succeeds();
var
Expected: Cardinal;
Value: string;
Actual: Cardinal;
begin
Expected := High(Cardinal);
Value := Expected.ToString();
Actual := Cardinal.Parse(Value);
Assert(Expected = Actual);
end;
So I write some unit tests (see below) of which helpers for these types fail in one way or the other:
Nick Hodges did the technical review, and since Nick’s book are great I have high hopes (:
From the APress site:
Full Description
Dive into the world of MVVM, learn how to build modern Windows applications, and prepare for cross-platform development. This book introduces you to the right mindset and demonstrates suitable methodologies that allow for quick understanding of the MVVM paradigm. MVVM in Delphi shows you how to use a quick and efficient MVVM framework that allows for scalability, is of manageable complexity, and provides strong efficiency.
One of the biggest challenges developers face is how to convert legacy and monolithic Delphi applications to the MVVM architecture. This book takes you on a step-by-step journey and teaches you how to adapt an application to fit into the MVVM design.
What you’ll learn
Gain the fundamentals of MVVM
Visualize MVVM as a design philosophy
Create easy-to-use frameworks for building your own MVVM applications
Develop a methodology for converting legacy applications to the MVVM pattern
Architect cross-platform and multi-lingual applications using the MVVM pattern
Who this book is for
Delphi developers with a good knowledge of Delphi or programming experience in a different language. In addition, this book is attractive to Delphi developers who want to modernize existing applications based on the MVVM design.
and
Table of Contents
1. MVVM as Design Pattern
2. Setting Up the POSApp
3. MVVM as Design Philosophy
4. Two-way Communication
5. MVVM and Delphi
6. Planning the Application
7. Developing the Application
8. How to Convert your App to MVVM
A. Appendix: Other MVVM Delphi frameworks
An elaborate wrapper around the Define column is jedi.inc which is used in many projects (both open source and closed source) to distinguish between various Delphi versions, libraries and platforms at compile time (URL: github.com/project-jedi/jedi/blob/master/jedi.inc)
The Project Options in the Delphi IDE has a few option (like the Search Path) each with an ellipsis button (the one on the right having only three dots ... in the image below) to pop-up a dialog.