How to get listbox item position?

Hi,

I have a listbox in a form (ie : drawed on the spreadsheet, not in a dialog).

I use this macro to get the current value of the selected item.

oForm = ThisComponent.Sheets(0).getDrawPage().getForms().getByIndex(0) 
oListBox = oForm.getByName("myListBox")
print oListBox.CurrentValue

Now I’d like to get the position of the item as a number. I checked on this API page and tried this :

print oListBox.GetSelectedItempos

but with no success.

image description

Thank you for your ideas!

Here is how to access the position of an item in a form listbox :

items = oListBox.selectedItems
Print items(0)

credit to FJCC from [Solved] How to get listbox item position ? (View topic) • Apache OpenOffice Community Forum