Ask Your Question

function to set a selected row in a listbox

asked 2015-05-08 13:39:11 +0200

riq.willitts gravatar image

After updating a row in a listbox with SetItemText, the display reverts to showing the first rows. I would like to move the selection to the row foliowing the one just updated and for the listbox display to scroll to show this. Is there a function SetSelectedRow(RowNumber) or similar?

edit retag flag offensive close merge delete


Did you solve the problem? Same issue here. When I open a form focus should jump to the last row of the listbox.

LieberOffice gravatar imageLieberOffice ( 2016-04-06 14:34:01 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-04-08 18:09:46 +0200

Ratslinger gravatar image

The displayed item in the listbox is set by the index # of the item in the VIEW of the control.

oField1 = oForm1.getByName("Your FieldName")
Doc = ThisComponent
DocCtl = Doc.getCurrentController()
'Get VIEW for listbox
CtlView = DocCtl.GetControl(oField1)
CtlView.selectItemPos(IndexValueHere, True)

When a form is first opened, the control is sitting at index 0 (the first item in the list).

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2015-05-08 13:39:11 +0200

Seen: 625 times

Last updated: Apr 08 '16