LiveBindings Convert Integer Field To Boolean With Delphi XE5 Firemonkey On Android And IOS

Delphi XE6 Firemonkey LiveBindings Integer To BooleanMalcolm Groves has a blog post up where he demonstrates how to convert the display of a field from an integer to a boolean with Delphi XE5 Firemonkey. Should also work with Delphi XE6 and AppMethod. The way it works is that the same field (IntegerField from the demo) is bound to to a column in a grid. There is an outbound property called CustomFormat and an inbount property called CustomParse. In the CustomFormat field you put ToStr(%s) <> “0” and in the CustomParse field you put IfThen(ToStr(%s) = “True”, -1, 0). The properties take kind of a macro language where %s is the value to be modified and then you can use various different functions on the value. In this case a To String function and a If Then function. There are more screenshots you can check out which will make it more clear. Check out the source code here. One of the comments from Mathias on the blog post points out a different way to accomplish the Integer to Boolean functionality with LiveBindings and it also includes a demo. One plus about this second demo is that it applies the integer to boolean conversion through your entire project instead of having to set it up for each field like the first method. Both of these methods should work cross platform on Android, IOS, Windows, and OSX. Here is some sample code from the second demo:

Check out the full blog post about converting from an integer to a boolean using LiveBindings.

Mirror: Download a copy of the source code from the second integer to boolean LiveBindings sample.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

One Response to LiveBindings Convert Integer Field To Boolean With Delphi XE5 Firemonkey On Android And IOS

  1. flavio says:

    Very help, thanks (obrigado)

Leave a Reply to flavio Cancel reply

Show Buttons
Hide Buttons
Read previous post:
DataSnap Mobile Client Server Demo For Delphi XE6 Firemonkey On Android And IOS

Paweł Głowacki from Embarcadero has a blog post up with full demo source code for building a mobile DataSnap client...