Das ist jetzt etwas seltsam, aber ich kann aus deinem Dokument bei aktivem Blatt 'Bestellformular' folgenden Code ohne Fehlermeldung ausführen:
Code: Alles auswählen
def listbox_untersuchen():
doc = context.getDocument()
sel = doc.getCurrentSelection()
controller = doc.getCurrentController()
sheet = sel.getSpreadsheet()
page = sheet.DrawPage
form = page.Forms.getByName('Form')
boxcontrol = controller.getControl(form.getByName('List Box 7'))
#mri.inspect(boxcontrol)
boxcontrol.selectItemPos(0,1) #funktioniert !
Code: Alles auswählen
def listbox_untersuchen():
doc = context.getDocument()
sel = doc.getCurrentSelection()
controller = doc.getCurrentController()
sheet = doc.Sheets.getByName('Bestellformular')
page = sheet.DrawPage
form = page.Forms.getByName('Form')
controller.setActiveSheet( sheet ) #'Bestellformular' aktiv setzen
boxcontrol = controller.getControl(form.getByName('List Box 7'))
#mri.inspect( boxcontrol )
boxcontrol.selectItemPos(0,1) #funktioniert !
Karolus