Programmer Guide > Working with Lists and Associative Arrays > Defining a List within a Structure within an Associative Array
  

Defining a List within a Structure within an Associative Array
The following example shows how to nest a structure and a list within an associative array. This example has applications in GUI tool development, where associative arrays can be used to store information about the attributes of a GUI tool.
; Define a data structure to hold variables and attributes for a
; GUI tool.
strDef = {Main_Data_Str, attrs:ASARR(), vars: LIST()}
; Create an empty associative array that will hold the GUI tool
; data structure. This array will be filled in later, possibly
; in another procedure.
dataStr = ASARR()
; Call the tool Wg1.
dataStr('Wg1') = {Main_Data_Str}
; Set a size attribute for the Wg1 tool.
dataStr('Wg1').attrs('size') = [512, 512]
; Set a list of variables for the Wg1 tool. 
dataStr('Wg1').vars = LIST('VAR1', 'VAR2')

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.