OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[SOLVED - Doh!] Can't Populate a ListBox on a Dialog

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
canuck
General User
General User


Joined: 17 Feb 2012
Posts: 9
Location: Canada

PostPosted: Mon Apr 23, 2012 11:31 am    Post subject: [SOLVED - Doh!] Can't Populate a ListBox on a Dialog Reply with quote

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.)
Embarassed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group