Archive for May 2014

Another fix of Delphi code – Click on the ListView

My customer found another but at Delphi application:

TListView Bug

 

If you click at TListView on the empty are, last item get automatically selected and events as  OnClick and OnItemClick are called.

Well it can be nice feature for someone, but it’s not really logical .. for example if you have open keyboard and you want to hide it, by clicking at the empty area.

There is no settings to tun this behavior off as it’s hard coded.

The problem is at FMX.ListView.pas unit at FindItemAbsoluteAt procedure, line 4060.

This code:

if ViewAt >= HeightSums[HeightSums.Count - 1] then
 Exit(HeightSums.Count - 1);

Replace with this code:

 if ViewAt >= HeightSums[HeightSums.Count - 1]+GetItemHeight(HeightSums.Count-1) then
 Exit(-1);

And the system will start to work logically.

You can download modified unit here, just include into your project.

Fixes of TMemo for Samsung Android

One of my customer reported falling of the Delphi XE5 Application at his Samsung Android device.

DelphiBug

When he was quickly typing multiple lines after while the app crashed.

It took me while to get the problem replicated, but eventually I found the bug.

It’s at the FMX.Platform.Android unit at TTextServiceAndroid.DrawSingleLine procedure.

From some reason the FCaredPosition is out of the range of the FLines StringList.

Replace this code:

if (FLines.Count > 0) then

with

if (FLines.Count > 0) and (FCaretPosition.Y>=0) and (FCaretPosition.Y<Flines.Count) then

 

Or you can download fixed unit here and simply included it into your project.

Embarcadero recently released new version of Delphi – XE6. Well I would suggest them to focus on fixing bugs at existing XE5 for people who already purchased their product, rather then release new version ever few months.

Accessing contacts from Delphi at iOS and Android

Recently I was doing an application that needs to access contacts at the iOS and Android.

Contacts

I found those two pieces of code

1) http://www.fmxexpress.com/access-ios-contacts-with-firemonkey-in-delphi-xe5/

2) http://www.fmxexpress.com/access-android-contacts-manager-with-firemonkey-in-delphi-xe5/

that works.

But you need different unit for each platform and the names of fields are also little but different.

Read more