Ask Your Question

Base: How to change ListBox SelectedValue via LO Basic [closed]

asked 2014-08-07 15:57:57 +0200

doug gravatar image

updated 2020-07-10 21:33:11 +0200

Alex Kemp gravatar image

Trying to use LO Basic macro to change value of List Box in LO Base form. The ListBox is on a grid control on the form.

short problem: when I change the .SelectedValue = newvalue, it does not change the list. This operation does change the .currentvalue (can see this by printing), whch when queried on other lines with saved values, returns the list value. However, the form is not actually refreshing or recognizing the list position when I change it. I tried .refresh, but that did not seem to do anything.

to get started:

dim new_val
dim frm, ofForm, oControl
frm = ThisComponent.Drawpage.Forms
ofForm = frm.getByName("MyForm")
oControl = ofForm.GetByName("MainForm_Grid")

looking for the ListBox equivalent of :

oControl.GetByName("text1").text = new_val


oControl.GetByName("list1").SelectedValue = new_val

this sort of worked, because when I then

print oControl.GetByName("list1").currentvalue

it returns new_val, which suggests the operation was successful.

However, on the actual form, the new_val was not saved or displayed, remained blank, no effect. May be a bug, or I may be missing something.

The SDK reference is here.

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 2020-08-15 00:22:51.386297



This is a bug for the grid. Filing bug report.

doug gravatar imagedoug ( 2014-08-07 17:19:40 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-01-19 18:43:05 +0200

doug gravatar image

Needed to take second action in grid.


This might be best practice for other object types, but with grid list it only works this way.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-08-07 15:57:57 +0200

Seen: 3,037 times

Last updated: Jan 19 '15