Re: Listbox ersten Eintrag auswählen
Verfasst: Do, 15.11.2012 17:28
Hallo
Das ist jetzt etwas seltsam, aber ich kann aus deinem Dokument bei aktivem Blatt 'Bestellformular' folgenden Code ohne Fehlermeldung ausführen:
Edit: es liegt bei dir daran das das Blatt 'Bestellformular' zum Zeitpunkt des Aufrufs nicht aktiv ist, das musst du im Code nachholen.
Das funktioniert auch aus jedem anderen Tabellenblatt.
Karolus
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