- The some of the shortcut keys do not seem to work.
- Function keys required pressing FN key as well as function key.
- For some reason the cap locks gets pressed on the VM, meaning I have to open the on-screen keyboard to remove it.
Tuesday, 29 October 2013
Running Delphi XE in Parallels Desktop on iMac
I currently use Parallels Desktop to run a Windows VM on my iMac, this works great for most applications, however there are a couple of issues I have found with Delphi.
Monday, 28 October 2013
Delphi XE5 - The quickest way C# developers can produce Apps
With Delphi XE5, a software developer can produce apps for both iOS and Android from the same code base. But which developers will want to do this?
If you are an iOS developer, it is most likely you are comfortable just developing app for Apple devices and that the company you work for employs Android developers for the Android version and vis versa. And you have no need or want to learn a new language to get the same results.
However, if you are a C# developer then Delphi XE5 might be the quickest way to develop Apps. I found moving from Delphi to C# very easy and after 1 day was developing C# web services. I also found it easy switching back to Delphi after using C# for some months.
So if you are a .Net developer then I would recommend you at least have a look at Delphi XE5.
If you are an iOS developer, it is most likely you are comfortable just developing app for Apple devices and that the company you work for employs Android developers for the Android version and vis versa. And you have no need or want to learn a new language to get the same results.
However, if you are a C# developer then Delphi XE5 might be the quickest way to develop Apps. I found moving from Delphi to C# very easy and after 1 day was developing C# web services. I also found it easy switching back to Delphi after using C# for some months.
So if you are a .Net developer then I would recommend you at least have a look at Delphi XE5.
Thursday, 22 August 2013
DevExpress Quantumgrid Header Height
I have had a problem recently using a DevExpress Quantum Grid which has the column filters enabled and also the ability to drag and drop. I needed a way to get the header height so it would ignore the begindrag. The after trying a few things this is the best way I found to get the header height.
iHeaderHeight := GridView.ViewInfo.HeaderViewInfo.Bounds.Bottom -
GridView.ViewInfo.HeaderViewInfo.Bounds.Top;
iHeaderHeight := GridView.ViewInfo.HeaderViewInfo.Bounds.Bottom -
GridView.ViewInfo.HeaderViewInfo.Bounds.Top;
Friday, 16 August 2013
You can now develop software for both iOS and Android
I've just read on the Embarcadero blog that you can take an iOS app developed in Delphi and retarget it to work as an Android app. Delphi for Android is still in beta, but this is a significant step to developing software in a single language and deploying it multiple platforms, and importantly the software run natively. If this works as well as they give the impression, Delphi will have solved one of the biggest issues with software development, that is employing different developers to develop similar software for different platforms. Because of this Delphi must surely become more popular.
Thursday, 18 July 2013
How NOT to handle exceptions
Just been working with some code and saw this little gem.
try
{Some code}
except
showmessage('error');
end;
This is a good example of the developer being lazy and not being bothered to do something better. Can you imagine the user ringing up support and saying they are getting a 'error' message, it's not even with a capital 'E'.
There are a couple of issues I have with this bit of code. Firstly I have a rule that showmessage() is used while developing and should be removed when a deployment build is done, if a message needs to be displayed it should be in an message dialog (MessageDlg). The reason for this is that a message dialog looks better with icons specify what the message is, I use GExperts to create the code. Also, when developing I can quickly search for 'showmessage' and can see what messages need to be removed, this means there are no embarrassing debug messages displayed to the user.
Secondly is the message just says error, which it not helpful to the user or the developer when it is reported. The developer could have done something better by giving a more useful message like 'An error has occurred while...', with what the operation is doing. The developer could have also included the exception message like the following.
try
{Some code}
except
on e: exception do
MessageDlg('An error has occured in...' + e.Message, mtError, [mbOK], 0);
end;
try
{Some code}
except
showmessage('error');
end;
This is a good example of the developer being lazy and not being bothered to do something better. Can you imagine the user ringing up support and saying they are getting a 'error' message, it's not even with a capital 'E'.
There are a couple of issues I have with this bit of code. Firstly I have a rule that showmessage() is used while developing and should be removed when a deployment build is done, if a message needs to be displayed it should be in an message dialog (MessageDlg). The reason for this is that a message dialog looks better with icons specify what the message is, I use GExperts to create the code. Also, when developing I can quickly search for 'showmessage' and can see what messages need to be removed, this means there are no embarrassing debug messages displayed to the user.
Secondly is the message just says error, which it not helpful to the user or the developer when it is reported. The developer could have done something better by giving a more useful message like 'An error has occurred while...', with what the operation is doing. The developer could have also included the exception message like the following.
try
{Some code}
except
on e: exception do
MessageDlg('An error has occured in...' + e.Message, mtError, [mbOK], 0);
end;
Labels:
Delphi,
error,
exception,
Handle,
messagedlg,
not,
showmessage
Friday, 5 July 2013
Delphi XE4 - The future of software development?
Delphi XE4 - The future of software development?: I have been working in software development for 15 years and have seen some changes, but nothing as much as what has happened recently. Over...
Monday, 1 July 2013
Delete files with a wildcard
Here is how to delete files with a wildcard. It requires SysUtls in the uses clause.
procedure DeleteFiles(FilePath, Wildcard: string);
var cSearchRec: TSearchRec;
iFind : integer;
sPath : string;
begin
sPath := IncludeTrailingPathDelimiter(FilePath);
iFind := FindFirst(sPath + Wildcard, faAnyFile, cSearchRec);
while iFind = 0 do
begin
DeleteFile(sPath + cSearchRec.Name);
iFind := FindNext(cSearchRec);
end;
FindClose(cSearchRec);
end;
In the while loop you can add additional conditions, like only files that have a specific prefix e.g.
if Pos(fPrefix, Copy(cSearchRec.Name, 0, Length(fPrefix))) > 0 then
procedure DeleteFiles(FilePath, Wildcard: string);
var cSearchRec: TSearchRec;
iFind : integer;
sPath : string;
begin
sPath := IncludeTrailingPathDelimiter(FilePath);
iFind := FindFirst(sPath + Wildcard, faAnyFile, cSearchRec);
while iFind = 0 do
begin
DeleteFile(sPath + cSearchRec.Name);
iFind := FindNext(cSearchRec);
end;
FindClose(cSearchRec);
end;
In the while loop you can add additional conditions, like only files that have a specific prefix e.g.
if Pos(fPrefix, Copy(cSearchRec.Name, 0, Length(fPrefix))) > 0 then
Subscribe to:
Posts (Atom)