1.4.3. Accessing the Value of an RP Variable In Your GUI

It is often necessary to access RP variable values in your GUI as well as your UDF. This can be useful in order to display the existing values of each variable each time the GUI is opened. By doing this, you know the existing value of an RP variable each time you go to change it. In order to access an RP variable in Scheme, you must use the (rpgetvar) macro. This macro is often used to set the value of a local variable to the current value of an RP variable. For example, if you have an integer entry box called localInt and an integer RP variable called rpInt, you could set the value of localInt to the value of rpInt by using the following statement.

(cx-set-integer-entry localInt (rpgetvar 'rpInt))

Since this statement is meant to update the values in each field when you open your GUI, this type of statement is usually seen in the update-cb function, which is called each time a GUI dialog box or task page is opened.


Release 18.2 - © ANSYS, Inc. All rights reserved.