Modify the text of a list box

MINI LESSONS ›› Actions Editor ››


Programmatically setting or getting the text of a field using the Actions Editor would seem to be straight forward - you just manipulate the Text property of the field object.

However unlike a regular text field, a single select listbox and multi select listbox field function a bit different when it comes to setting or getting the text using the Actions Editor. In fact there is no Text property for the single select listbox and multi select listbox fields available in the Actions Editor. Instead there is a ItemText property.

The way that the ItemText property is implemented within ToolBook is not as Raw Text like the normal Text property is - instead it is implemented as an array.

Note that the array is a 0 based array so technically element 0 of the array is textline 1, element 1 of the array is textline 2 and so on.

In order to access this Array property you first have to copy it into an Array variable.

You are permitted to replace this ItemText property with an entirely different array or you can individually update only certain elements (lines) of the listbox.


Consider a listbox with 3 lines in it:




If I want to change ccc to zzz using the Actions Editor, code similar to this would be used:

  set myTempArray to itemText of field "theListBox"

  set myTempArray[2] to "zzz"

  set itemText of field "theListBox" to myTempArray


When you create a listbox with a certain number of textlines in it, you will be unable to programmatically add or remove textlines from that listbox using the Actions Editor. In other words, if you have 5 textlines in the field, you'll not be able to reduce that to 4 or increase that to 6 programmatically.

Created with the Personal Edition of HelpNDoc: Free help authoring environment