NOTICE: The Processors Wiki will End-of-Life in December of 2020. It is recommended to download any files or other content you may need that are hosted on The site is now set to read only.

GUI Composer/Bind Expressions

From Texas Instruments Wiki
Jump to: navigation, search

GUI Composer Binding Expressions

A widget property can be bound to C expression that can have two or more target variables. For example: If var1 and var2 are two target variable a label can bind to: var1 + var2 * 6 . In this case the binding is one directional - changing the property value will not change any variable on the target. The C expressions can include arithmetic operators ( +, -. *, /, %), boolean operators ( &&, ||, !, ~ ) ,comparison operators ( <, >, >=, <=, ==) , ternary operator (?:) , number constants or target variables. The precedence of the operators is the same as in C language. Parenthesis can be used in the expressions.

Using a ternary and boolean operators

Very useful case of the above feature is using C ternary operators with combination of boolean operators. For example, to limit the displayed value of a variable between 0 and 10, an expression like this can be used:

(var1 >= 0 ) ? (( var1 <= 10) ? var1 : 10) : 0

Even the target variable can be outside of the range [0,10] the widget will only display values in that range.

Binding to struct members

If the target program has defined C structs, widget now can bind to a specific members of global variables of these structs. For example, if the target program defines the following data structures and a global variables:

<syntaxhighlight lang=C>

typedef struct Point {

  int x;
  int y;

} Point;

typedef struct Rect { Point topLeft; Point bottomRight; } Rect;

Rect R;


A widget can bind to a specific integer filed of the global variable R: R.topLeft.x. The binding will be bi-directional.

Binding to array elements

If the target program has number arrays or multidimensional number arrays, widgets can bind to specific elements of these arrays. The binding will be bi-directional.

<syntaxhighlight lang=C>

int arr[4] = { 1,2,3,4 }; int twoDim[2][2] = {{ 1,2},{3,4 }};


One widget can bind to arr[2]. Another widget can bind to: twoDim[1][2]

Binding to C strings

Widgets now can bind to C strings – zero terminating char arrays. For example, if the target defines:

<syntaxhighlight lang=C>

char* name = "John Smith";


A Label can bind to name to display the value of the zero terminating string. In this case the binding is one directional. The user cannot use an edit box to change the values of array elements.

Binding to an array of C Strings

Widget properties that bind to arrays can now bind to an array of C strings. This binding is one directional. For example, if the target defines:

<syntaxhighlight lang=C>

char* names [] = { "John", "Peter", "Alex" };


A ListBox can bind its Labels property to names.

Binding to a GEL expression

For C expression that involved pointers and other operation not supported by GUI Composer it is possible to redirect evaluation of the expression to the debugger GEL evaluator. To do that the widget property needs to bind to evaluate['<<GEL_EXPRESSION>>’]. The binding is two directional. For example, if the target program is:

<syntaxhighlight lang=C>

int A = 1; int* ptrA = &A;


We can bind a TextEdit’s value property to evaluate['*ptrA']. This allows pointers to be used in GUI Composer.

Binding to target registers

I widget property can bind to target register. For example: PC. The binding is bidirectional.