TrueGui Help
Expressions

Glossary Item Box

 

Introduction 

The TrueGUI syntax parser can handle complete expressions for arguments. These expressions can use standard operands and operators in the normal fashion with parenthesis setting operator precedence as required. Expressions may be used in property, field, method and index arguments. Methods that return a value may be used as operands in these expressions with the return value being used as the operand. The following sections describe the operators and operands that are supported.

 

Operators 

The following operators are supported in TrueGUI expressions: 

+

addition or unary plus

-

subtraction or unary minus

*

multiplication

/

division

 

 

NOT

logical NOT

AND

logical AND

OR

logical OR

XOR

logical XOR

 

 

MAX

maximum value

MIN

minimum value

 

 

=

equal

#

unequal

<>

unequal

><

unequal

<

less than

>

greater than

<=

less than or equal

=<

less than or equal

>=

greater than or equal

=>

greater than or equal

 

Operands 

The following operand types are supported in TrueGUI expressions: 

Integer

Floating point

String

Character

Boolean

Method return values

User objects

Subexpressions (...)

 

Examples 

The following examples show some TrueGui commands using valid expressions. Some properties and methods are fictitious and used for illustrative purposes only. Parenthesis are used for clarity but may not always be necessary in the expression. Standard AlphaBASIC hierarchy will define operator precedence when parenthesis are omitted. With most programming, parenthesis assure the desired behavior. 

PRINT "{ button1.Width = (button2.Width + 50) }" 

PRINT "{ button2.Height = (items.GetCount() * 20) }" 

PRINT "{ label1.Text = (button1.Text + ` ABCDE`) }" 

PRINT "{ listbox.Items[1].Text = (name.First + ` ` + name.Last) }" 

PRINT "{ MyNumber = AddTwoNumbers(15, (button7.Width + 15)) }"

 

The last example shows the use of a user object to store the result of the fictitious AddTwoNumbers(x,y) method. The second argument of this method shows a simple expression being used for the second number. See the section on User Objects for more details.