Apache OpenOffice (AOO) Bugzilla – Issue 70087
The empty string is an (undocumented) invalid item for a com.sun.star.TextField.DropDown
Last modified: 2017-05-20 11:26:04 UTC
The following macro creates a new DropDown-Field in a textdocument and sets its itemlist to the elements ["foo", ""]. After setting the SelectedItem property to "", the DropDown displayes "foo" which is not the whished element. So it seems to me that an emty string is treated like a invalid element, but I can't see why empty string should not be allowed within dropdown fields. Also this behaviour is even not documented in the idl and it is inconsistent with the behaviour of other TextFields (e.g. InputField) which allow empty string. I think one of the following two things should be done: 1) document the behaviour that an empty string is invalid in the idl-docu that describes the properties "Items" and "SelectedItem" OR 2) change the code in a form that an empty string is not longer a invalid item and is accepted and displayed correct. here the code: Sub dropDownBoxMissbehaviour dim items(2) as String items(0) = "foo" items(2) = "" doc = ThisComponent dd = doc.createInstance("com.sun.star.text.TextField.DropDown") dd.Items = items() dd.SelectedItem = "" doc.Text.insertTextContent(doc.Text.Start, dd, true) End Sub
in my code there's one mistake: the statement 'items(2) = ""' should be 'items(1) = ""'. But even after correcting the mistake, the behaviour is the same, so the ticket is still valid.
Reassigned to JSK.
Sounds more API like -> cn
cn->fs: there seems to be an issue. The IDL sayes to "select" The selected item. If no item is selected this property contains an emtpy string. If this property is set to a value not present in the items of the dropdown field it is invalidated, i.e. it is set to an empty string. But I get always "foo", regardless of invalid or empty string.
cn->fs: for you
that's no form control, that's a text field.
Set target to OOo Later
Reset assigne to the default "issues@openoffice.apache.org".