Ask Your Question
0

How to get listbox item position ? [closed]

asked 2014-04-23 07:28:35 +0100

sulliwane gravatar image

updated 2015-09-07 22:18:53 +0100

Alex Kemp gravatar image

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!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-02-21 07:19:31.650430

1 Answer

Sort by » oldest newest most voted
0

answered 2014-04-24 07:32:00 +0100

sulliwane gravatar image

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

items = oListBox.selectedItems
Print items(0)

credit to FJCC from https://forum.openoffice.org/en/forum...

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-04-23 07:28:35 +0100

Seen: 1,769 times

Last updated: Apr 24 '14