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

problem with listbox in sheet

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
robvit
General User
General User


Joined: 23 May 2007
Posts: 6

PostPosted: Tue May 29, 2007 11:57 am    Post subject: problem with listbox in sheet Reply with quote

Sorry I have a big problem about listbox or another object inside sheets of calc.
If I have a listbox in a Dialog I write:

Dim Dlg As Object
DialogLibraries.LoadLibrary("Standard")
Dlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
Dlg.title (" Ciao ")
dim lista(1 to 10) as string
lista(1) = "Ciao"
lista(2) = "Buon"
lista(3) = "giorno"
lista(4) = "Salve"
lista(5) = "hello"
lista(6) = "Ola"
lista(7) = "Hi"
lista( = "Miao"
lista(9) = "Cui"
lista(10) = "Fiao"

If I have a listbox inside of sheet maybe I must write:

dim doc as object
dim sheet as object
doc = StarDesktop.CurrentComponent
sheet = doc.sheets(0)
dim con as object
con = doc.sheets(0).getcontrols
con = sheet.getbyname("ListBox")
con.additems (lista, 0)

but this is not good....
Where is the error?
Please help me!
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Tue May 29, 2007 12:29 pm    Post subject: Reply with quote

con = doc.sheets(0).getcontrols
con = sheet.getbyname("ListBox")
I guess it is somewhere here, but you did not tell us. You did not tell which error occurs where and you posted in the wrong forum.
This is the right one for this kind of question
http://www.oooforum.org/forum/viewforum.phtml?f=9
This is the right one for working code. No questions there, please.
http://www.oooforum.org/forum/viewforum.phtml?f=10
Here you can search this site:
http://www.oooforum.org/forum/search.phtml
If this form is too limited then you may prefer a site-search through your prefered search engine.
_________________
Rest in peace, oooforum.org
Get help on http://forum.openoffice.org
Back to top
View user's profile Send private message
robvit
General User
General User


Joined: 23 May 2007
Posts: 6

PostPosted: Wed May 30, 2007 7:12 am    Post subject: Reply with quote

Yes, thanks for the link....
but my problem is between sheets of calc and code Visual Basic of open office...
so I propose this question in forum for macro a week ago, but there aren't
people the write for me... so I try here.
Good, I hope that you can help me...
I don't know like I must define an combo box or list box when they are not inside a form,
but in the sheet of document calc.
Please there are week that I ask, maybe you or your friend can help me!
Thanks
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Wed May 30, 2007 7:27 am    Post subject: Reply with quote

Writer has one DrawPage which can take forms.
Impress and Draw consist of DrawPages.
Calc has one DrawPage per sheet.
Once you have the DrawPage the type of document makes no difference. This office is one single application.
First form on the draw page of first sheet:
oSheet = thisComponent.Sheets.getByIndex(0)
oDP = oSheet.DrawPage
oForm = oDP.Forms.getByIndex(0)

You will find tons of examples if you search hard enough.
_________________
Rest in peace, oooforum.org
Get help on http://forum.openoffice.org
Back to top
View user's profile Send private message
robvit
General User
General User


Joined: 23 May 2007
Posts: 6

PostPosted: Wed May 30, 2007 8:54 am    Post subject: Reply with quote

Sorry, I want show you all macro, so you can help me better Very Happy :


Sub Main
dim lista(1 to 10) as string
lista(1) = "Ciao"
lista(2) = "Buon"
lista(3) = "giorno"
lista(4) = "Salve"
lista(5) = "hello"
lista(6) = "Ola"
lista(7) = "Hi"
lista(Cool = "Miao"
lista(9) = "Cui"
lista(10) = "Fiao"
dim oSheet as object
dim oDP as object
dim oForm as object
oSheet = thisComponent.Sheets.getByIndex(0)
oDP = oSheet.DrawPage
oForm = oDP.Forms.getByIndex(0)
dim oListbox as object
oListbox = oForm.getbyname("ListBox")
oListbox.additems (lista, 0) Embarassed
end sub

This program give me error in the last line and tell me :
error of runtime basic
propriety or metod not valid Question Question Question Question Question Question Question
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 Calc 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