| View previous topic :: View next topic |
| Author |
Message |
robvit General User

Joined: 23 May 2007 Posts: 6
|
Posted: Tue May 29, 2007 11:57 am Post subject: problem with listbox in sheet |
|
|
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 |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
|
| Back to top |
|
 |
robvit General User

Joined: 23 May 2007 Posts: 6
|
Posted: Wed May 30, 2007 7:12 am Post subject: |
|
|
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 |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Wed May 30, 2007 7:27 am Post subject: |
|
|
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 |
|
 |
robvit General User

Joined: 23 May 2007 Posts: 6
|
Posted: Wed May 30, 2007 8:54 am Post subject: |
|
|
Sorry, I want show you all macro, so you can help me better :
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( = "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)
end sub
This program give me error in the last line and tell me :
error of runtime basic
propriety or metod not valid  |
|
| Back to top |
|
 |
|