The attached database is a database I'm building pertaining to my book library. If you open "MyLibrary" and click on the Google looking button next to the second line dropdown (reads "Orson Scott Card") Google will search for the AuthorID (12) instead of the actual value in the drop down ("Orson Scott Card"). OOo works as expected and searches for the actual value in the dropdown (i.e., the author's name).
Here is the code used in my macro:
Dim launcher As Object
Dim aWebPage As String
myLibraryForm = ThisComponent.Drawpage.Forms.getByName("MainForm")
book_author = myLibraryForm.getByName("Author").CurrentValue
launcher = CreateUnoService("com.sun.star.system.SystemShellExecute")
aWebPage = "https://www.google.com/search?source=hp&ei=NUpNW6KJAoritQXXqozYCw&q=Author: " & book_author
launcher.execute(aWebPage, "", 0)
Steps to Reproduce:
1. Open attached database
2. Open Form Document named "MyLibrary"
3. Click on the Google looking button next to "Orson Scott Card"
Browser opens and Google searches for "Author: 12".
Browser should open and search for the actual value in the dropdown which would be "Author: Orson Scott Card"
User Profile Reset: Yes
Not an issue in OOo 4.1.5.
Created attachment 143618 [details]
This is the database.
You are correct currentvalue does return a different result between AOO and LibO, and appears to have done so since LibO 4.1.
I find this mentioned in a comment, from 2015, on an issue https://bugs.documentfoundation.org/show_bug.cgi?id=91828#c10
"Since LO 4.1 CurrentValue of a listbox changed to the value, which should be saved in the database. Older versions will show the text, which could be seen on the screen."
That sounds a bit like it might of been intentional, but I read over the release notes for 4.0, 4.1 and 4.2 in which there is mention of changes to checkbox form controls, but none about listbox and a change in currentvalue. Nor could I see any mentioned in the API changes listed there.
For a workaround you just need to treat the control as if multi-select is turned on and use the SelectedItems and ListItems to retrieve the string.
This is a feature, not a bug. There are differences between LO and AOO. Special:
Since LO 4.1 the current value in listboxes gives the value, which is submitted to the database.
Since LO 4.1.2 datafields must be read by oField.currentValue.Year ...Month ...Day
You could get the value, which is shown in the listbox, with
DIM oDoc AS OBJECT
DIM oForm AS OBJECT
DIM oListbox AS OBJECT
DIM oController AS OBJECT
DIM oView AS OBJECT
oDoc = thisComponent
oForm = oDoc.Drawpage.Forms(0)
oListbox = oForm.getByName("Listenfeld")
oController = oDoc.getCurrentController()
oView = oController.getControl(oListbox)
print "Angezeigter Inhalt: " & oView.SelectedItem
Works with LO and AOO.
(In reply to robert from comment #3)
> This is a feature, not a bug. There are differences between LO and AOO.
> Since LO 4.1 the current value in listboxes gives the value, which is
> submitted to the database.
> Since LO 4.1.2 datafields must be read by oField.currentValue.Year ...Month
Well, then the issue needs to be set to, notabug.
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":
crashtesting: intermittent failure on tdf118824-1.odb
It will be available in 7.1.0.
The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
Affected users are encouraged to test the fix and report feedback.