Thursday, February 23, 2012

Physical Measure User Control

When you need to enter a physical measure into your application (like height, weight, temperature, volume, etc.), you usually need to specify the metric system to use along with the value. You may even need to let the user choose the metric system.

Creating the user interface to solve this problem has some difficulties.

For example, if you need to enter a person's height in meters or feet, you may want to provide a wheel picker with values for {meters, centimeters} or {feet, inches} depending on the user's selected metric system. The problem you will be facing, is that the centimeters can go from 0 to 99, but the inches only from 0 to 11.

That's why we added a new user control, SD PhysicalMeasure, that is currently available in iOS and Android.

To use it, you'll need an attribute or variable with type Char or VarChar, and set the Control Type property to SD PhysicalMeasure in your layout. Right now the only measure supported is lengths in meters or inches, but we'll add support for the others in a future version.

The value must be a JSON object with keys Unit, Value and ConvertedValue, that can be created by applying the ToJSON() method to a SDT with the following structure:


You can also parse the resulting JSON by calling FromJSON().

The ConvertedValue is ignored when the user control reads the value, and is provided when the control saves the value. It is always in the decimal metric system unit for the given measure.

This is how the control looks in runtime




Wednesday, February 15, 2012

Runtime translation in applications

In the latest builds of GeneXus X Evolution 2, runtime translation has been added to the Android and iOS generators.

This means that you can have your application translated to the user's device language automatically, just by providing the translation of the application strings to the supported languages.

To configure how the translation is handled, you can use the same property available to the Web generators: Translation Type (in the Environment settings). The available options are "No translation", "Static" or "Run-time".