Archive for the ‘Delphi XE8’ Category
Posted by jpluimers on 2017/01/05
Something to remember: Delphi To Go: Include resource files in your Delphi build process
Note it’s not enough to add a line like this to your .dpr file:
{$R 'New1.res' 'New1.rc'}
The resources actually needs to be part of your .dproj file (which basically is an XML msbuild file adhering to the MSBuild Project File Schema Reference).
That way, the BrccCompile target in $(BDS)\bin\CodeGear.Delphi.Targets will automatically pick it up during build.
I just checked and these target files support BrccCompile:
...\Embarcadero\RAD Studio\7.0\bin\CodeGear.Delphi.TargetsÂ
...\Embarcadero\RAD Studio\8.0\bin\CodeGear.Delphi.TargetsÂ
...\Embarcadero\RAD Studio\9.0\bin\CodeGear.Delphi.TargetsÂ
...\Embarcadero\RAD Studio\10.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\RAD Studio\11.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\RAD Studio\12.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\Appmethod\13.0\bin\CodeGear.Delphi.Targets
...\Embarcadero\Studio\14.0\bin\CodeGear.Delphi.TargetsÂ
...\Embarcadero\Studio\15.0\bin\CodeGear.Delphi.TargetsÂ
...\Embarcadero\Studio\16.0\bin\CodeGear.Delphi.TargetsÂ
...\Embarcadero\Studio\17.0\bin\CodeGear.Delphi.TargetsÂ
...\Embarcadero\Studio\18.0\bin\CodeGear.Delphi.Targets
Which means it’s available as of Delphi 2007 until at least Delphi 10.1 Berlin and might even work in Delphi 2006
It could be a little bit flakey in Delphi 2007 (I’ve had many msbuild issues there) but more recent versions should be fine.
–jeroen
Related: I have a big file to add +’ at the beginning of a line and ‘ at the end…- shlomo abuisak – Google+
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Resource Files and Scripts (.res/.rc), Software Development | Leave a Comment »
Posted by jpluimers on 2016/12/29
In recent Delphi version, FastReport version 5 ships. But for parts of FastReport, it’s a trial. This includes the FastScript part. The trial is very close to the real FastReport 5 thing. So real that when you compile you don’t see a difference, not even when trial and official things are mixed.
The only difference is that the trial will have a ShowMessage result like this:

ShowMessage(‘Unregistered version of FastScript’);
[Window Title]
Fastscriptexecute
[Content]
Unregistered version of FastScript.
[OK]
This occurred when I tried to move a the build process to a build server; a very tiny program will show this:
program FastScriptExecute;
uses
Vcl.Forms,
fs_iinterpreter;
{$R *.res}
var
fs: TfsScript;
begin
fs := TfsScript.Create(nil);
try
fs.Execute();
finally
fs.Free();
end;
end.
The build server had Delphi installed but not FastReports 5. I put all the sources in version control and fiddled with the project search paths until it built on the server.
Wrong!
Since the trial is so close to the real version, it will compile even if you don’t include all directories. In fact some permutations of the FastReports source and Delphi XE8 FastReports trial DUCs build perfectly fine.
Read the rest of this entry »
Posted in Delphi, Delphi XE8, Development, FastReport, Software Development | 1 Comment »
Posted by jpluimers on 2016/12/27
A long while ago, but still an interesting discussion: Is there a predictable order of execution for Class Constructors? leading to these links:
–jeroen
Posted in Conference Topics, Conferences, Delphi, Delphi 10 Seattle, Delphi 2010, Delphi x64, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Event, Software Development | Leave a Comment »
Posted by jpluimers on 2016/12/22
In functional programming, sequences are an important way of expressing logic.
This G+ post by Colin Johnsun discusses a library and a Spring4D way to handle sequences: I’ve release a library that allows you to iterate through a collection of items without using loops…
It’s interesting when mapping, reducing and solving many other problems in a functional way.
Background:
–jeroen
Posted in Delphi, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/12/20
Posted in Delphi, Delphi 10 Seattle, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, DUnit, Software Development | Leave a Comment »
Posted by jpluimers on 2016/12/07
Formy snippet archive (thanks Walter Prins for answering and Oliver Funcke for asking and elaborating on the answer):
in the case of error, you can get what would’ve normally been in the contentstream from the ExceptionObj.ErrorMessage property. Â So you can use something like the following if you want to get the content response regardless of http response code (untested):
var
FResponseStream: TStringStream;
FRequestURL, Content : String;
begin
//.... etc etc
try
FIdHTTP.Get(FRequestURL, FResponseStream);
Content := FResponseStream.DataString;
except
on E:EIdHTTPProtocolException do
Content := E.ErrorMessage;
end;
// At this point, "Content" contains the response body, both for
// successful (200) as well as other response codes.
//.... etc etc
end;
….
You can even do it simpler:
Response := IdHTTP.Get('http://host/path', [404]);
Source: delphi – Indy and REST – Can I prevent exceptions? – Stack Overflow
–jeroen
via:
Posted in Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 2 Comments »
Posted by jpluimers on 2016/12/01
Posted in Delphi, Delphi 10 Seattle, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development, Uncategorized | Leave a Comment »
Posted by jpluimers on 2016/11/29
A long time ago, Lars Fosdal wrote this on the Delphi G+ group:
It really is beyond me why there is no Project.rc file which includes
- Project.version.rc
- Project.icon.rc
- Project.themes.rc
- Project.manifest.xml
- and so forth.
That way, the .res file would be a compile-time thing (or even a thing of the past) – and the resource linker would assemble the various bits from their individual sources.
It has been an issue forever. Vincent Parrett correctly commented that if you clean out too much out of the Project.res file, the IDE gets confused:
The only thing it is used for is version info and the mainicon (the IDE gets confused if don’t do that).
In my own experience, this isn’t the case for all Delphi versions, but I forgot which versions suffer and which don’t. I think the IDE theming issue omitting the Application word in the .dpr is related.
Like many of the G+ commenters, I’ve switched to script based resources for my own projects a long time ago. That’s also the reason why I forgot: this approach just works for any Delphi version.
This post is a reminder to self to see if the IDE has finally refrained from doing Project.res handling itself.
–jeroen
Source: The curse of the Project.res file…
Some related posts:
Posted in Delphi, Delphi 1, Delphi 10 Seattle, Delphi 2, Delphi 2005, Delphi 2006, Delphi 2007, Delphi 2009, Delphi 2010, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Delphi 7, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 5 Comments »
Posted by jpluimers on 2016/11/24
Don’t you love relevant documentation…
There is no unit defined for the Vcl.Forms.TApplication.ActionUpdateDelay – RAD Studio API Documentation.
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.
UpdateActions in turn will call (for the form itself, all the form’s menu items and all the form’s controls) the TControl.InitiateAction which – if there is an associated ActionLink – will call the TBasicActionLink.Update which in turn will call the TBasicAction.Suspended and TBasicAction.Update methods of which the latter will call the TBasicAction.OnUpdate event if it is assigned.
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.
–jeroen
via:
Posted in Delphi, Delphi 10 Seattle, Delphi 10.1 Berlin (BigBen), Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2016/11/18
Nice error starting Delphi XE8:
[Window Title]
Error
[Content]
Registration procedure, Dbexpressentimpl.Register in package c:\program files (x86)\embarcadero\studio\16.0\Bin\DataExplorerDBXPluginEnt220.bpl raised exception class EWrapperError: Parameter MetaClass cannot be nil.
Do you want to attempt to load this package the next time a project is loaded?
[Yes] [No]
–jeroen
Posted in Delphi, Delphi XE8, Development, Software Development | Leave a Comment »