User`s guide

Share Data Among a GUI’s Callbacks
Share Data Among a GUI’s Callbacks
In this section...
“Share Data with Nested Functions” on page 13-11
“Share Data with UserData” on page 13-15
“Share Data with Application Data” on page 13-18
“Share Data with GUI Data” on page 13-21
The following four sections each contain complete code for example G UIs
that you can copy to code files and run. For general information about these
methods, see “Ways to Manage Data in a Programmatic GUI” on page 13-2.
Share Data with Nested Functions
You can use GUI data, application data, and the UserData property to share
data among a GUI’s callbacks. In many cases, nested functions enable you to
share data among callbacks without using the other data forms.
Nested Functions Example: Passing Data Between Components
This example uses a GUI that contains a slider and an edit text component. A
static text component instructs the user to enter a value in the edit text or
click the slider. The example initializes and maintains an error counter, as
well as the old and new values of the slider, in a nested functions environment.
13-11