NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

GUI Composer/Bind Expressions

From Texas Instruments Wiki
Jump to: navigation, search

GUI Composer Binding Expressions[edit]

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;

</syntaxhighlight>

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 }};

</syntaxhighlight>

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";

</syntaxhighlight>

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" };

</syntaxhighlight>

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;

</syntaxhighlight>

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.

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article GUI Composer/Bind Expressions here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article GUI Composer/Bind Expressions here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article GUI Composer/Bind Expressions here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article GUI Composer/Bind Expressions here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article GUI Composer/Bind Expressions here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article GUI Composer/Bind Expressions here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article GUI Composer/Bind Expressions here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article GUI Composer/Bind Expressions here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article GUI Composer/Bind Expressions here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity