Your close. See my example from the Winamp script:
For intLoop = 0 To UBound(arrKeys)
dObj.Control("lstWinampBookmarkSelection").Add CStr(arrKeys(intLoop)), intLoop
Next
dObj.Control("lstWinampBookmarkSelection").FocusedIndex = 1
The first parameter is a string and the second is the index position of the
item in question into the listbox. After the loop focus is set to the first
listbox item.
Hope this helps.
----- Original Message -----
From: Jeff Weiss
To: [email protected]
Sent: Friday, March 26, 2010 10:49 AM
Subject: adding items to an xml listbox
I am trying to change my TextToClip script to use an xml dialog instead of
the (shared object listbox) so that I can have additional buttons.
I need some help to understand how to add items to the listbox in the xml
dialog.
I don't want the listitems in the xml file, but rather I want to read item
names from a textfile and use these items in the listbox.
Part of the routine is below, and of course, the line to add items to the
listbox doesn't work.
Function DialogEventHandler(dObj, dEvent, dId, dControl)
DialogEventHandler = False
' read item names from a textfile and split into array elements
strContents = SOFileToString(ScriptBase & "List.txt", "Ascii")
MyArray = Split(StrContents, VbCrLf, -1, 1)
I = 1
For Each Item in MyArray
' this part doesn't work
dObj.AddItem MyArray(I), MyArray(I)
I = I + 1
Next
If some one could shed a little light here, I would appreciate it.
Jeff Weiss