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

Combobox - how do you know what is selected

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


Joined: 29 Sep 2004
Posts: 3
Location: CA

PostPosted: Wed Sep 29, 2004 11:03 am    Post subject: Combobox - how do you know what is selected Reply with quote

How do you get the value selected, using the comboboxes. Tried to do it using similar methods as ListBox but that didnt work. I am using StarOffice and writting macros, to access info in sheets. I have inclueded the code below and any assistance would be great !!!

Sub ListBoxSelected

Dim Doc As Object
Dim Sheet As Object
Dim DrawPage As Object
Dim Form As Object
Dim Ctl As Object

Dim Array(15) As String
ReDim Array2(15) As String
Dim TestString As Object

Doc = StarDesktop.CurrentComponent
Sheet = Doc.Sheets(0)
DrawPage = Sheet.DrawPage
Form = DrawPage.Forms.GetByIndex(0)

Ctl = Form.getByName("MainOwner")

< what comes next ..., tried 'selectedItems' cmd but it didnt work, an example of how to do it woould be great? >
Back to top
View user's profile Send private message
SergeM
Super User
Super User


Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

PostPosted: Wed Sep 29, 2004 11:33 am    Post subject: Reply with quote

I don't know what is "MainOwner" ? If it is a ComboBox you check
Ctrl.State
In fact reading the documentation, I see that my English is not good enough and I have make a confusion between ComboBox and checkBox : I am unable to say if these two words designate the same thing or not Embarassed
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Back to top
View user's profile Send private message Visit poster's website
LewisGalloway
Newbie
Newbie


Joined: 29 Sep 2004
Posts: 3
Location: CA

PostPosted: Wed Sep 29, 2004 12:19 pm    Post subject: Ctl.State doesnt work we get a property or method not found. Reply with quote

"Main Owner" is the name of the combobox (as in a pull-down menu).

The Ctl.State is useful for option and checkboxes but not comboboxes. But stillCtl.State returns 'property or method not found'. Only one option will be selected at a time the way I am using them. The documentation should allow the use of '.SelectedItems' to get an array of strings, of the selected items, I will only need the first. This doesnt work though I get the same error 'property or method not found'.
Back to top
View user's profile Send private message
pitonyak
Administrator
Administrator


Joined: 09 Mar 2004
Posts: 3618
Location: Columbus, Ohio, USA

PostPosted: Wed Sep 29, 2004 6:58 pm    Post subject: Reply with quote

I have very little information on a combobox control in my free macro document. My book, however, has some information:
Quote:
Provides text input or selection from a list of text values.

I discuss this on page 428 in my book (if you have it). You need to look at the Text property to see what the selected value is.

Does this help?
_________________
--
Andrew Pitonyak
http://www.pitonyak.org/oo.php
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
LewisGalloway
Newbie
Newbie


Joined: 29 Sep 2004
Posts: 3
Location: CA

PostPosted: Thu Sep 30, 2004 8:20 am    Post subject: Reply with quote

Yes this is exactly what I needed, thanks.
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