canuck General User

Joined: 17 Feb 2012 Posts: 9 Location: Canada
|
Posted: Mon Apr 23, 2012 11:31 am Post subject: [SOLVED - Doh!] Can't Populate a ListBox on a Dialog |
|
|
Hello
I'm working in Writer and I've created a simple Dialog that only contains a ListBox. I can get the Dialog on the screen, but I cannot seem to populate it. I don't get any errors when I run the code below, but none of the items that I add from the GList array show up in the ListBox. All I get is a completely empty ListBox. Any ideas?
| Code: | Sub Test
Dim Dlg As Object
Dim oCtl As Object
Dim GList(3) As String
GList() = Array( "Line 1", "Line 2", "Line 3", "Line 4" )
' Now we create an instance of the ListBoxDialog and fill it in
DialogLibraries.LoadLibrary("Standard")
Dlg = CreateUnoDialog(DialogLibraries.Standard.ListBoxDialog)
oCtl = Dlg.getControl("ListBox1") ' so we can get at the ListBox on the Dialog
oCtl.addItems(GList, 0) 'Fill the ListBox with the items from GList()
Dlg.Execute() ' Now show the Dialog on the screen
Dlg.dispose()
End Sub |
Here are the settings for "ListBox1":
Read Only: No
List Entries: (There are none)
Drop Down: Yes
Line Count: 4
Multiselection: Yes
Selection : (None)
Yes, I know, I know -- you can't use both a Drop Down and Multiselection. I learned this just now from playing with the Dialog's properties. (Doh!)
As this was clearly a newbie fumble of galactic proportions, and the community is no doubt fueling up their flame-throwers to respond, please allow me to toss the first marshmallow into the coming bonfire:
READ THE #*%! MANUAL!
Well said (and well deserved.)
 |
|