DlgListBoxArray

1 post / 0 new
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
DlgListBoxArray

The DlgListBoxArray is a really fun function but it is one that can cause lots of problems because of some undocumented issues.

The DlgListBoxArray allows you to dynamically change the contents of a dropbox in the dialog.  Without this command you have to define what is in the array before calling the dialog command, sometimes you might not have the information until the user has selected something from the dialog, such as the file and then the dropbox would be populated with the fields, without this you need to first have the user select the file and then call the dialog.  To use this command you just attach an array of items to it, so if you have an array is myArray() and the ID for the ListBox is myListbox the command would be

DlgListBoxArray "myListBox", myArray()

Now the possible problem with this is when you create a dialog there is a place in the dialog properties to attach the array, if you forgot to put anything (since technically you don't need anything as you are using the DlgListBoxArray function) what happens is that when you try and retrieve the value that is selected it will only return 0, if you put in an array, even if you don't use that array, you can then access the item that was selected.  Now I am not sure what IDEAScript is doing behind the scenes, maybe the DlgListBoxArray is being copied to the array that is attached through the properties and that is why it is necessary.