Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiDemoFiremonkeyIOSOSXWindows

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.

Related posts

Powerful Commercial Gorilla3D Framework Upgraded For Delphi FireMonkey On Windows And Android

AndroidC++BuilderCode SnippetDelphiDemoFiremonkeyIOSOSXShowcaseWindows

Powerful Cross Platform Email App Sample In Delphi 10.4.1 FireMonkey For Android And IOS


Significant Update Available For Delphi FireMonkey 10.4.1 On Android, IOS, OSX, Windows, And Linux


Professional SVG Icon Image List For Delphi 10.4 FireMonkey On Windows

Sign up for our Newsletter and
stay informed

1 Comment

Leave a Reply