Issue 70087 - The empty string is an (undocumented) invalid item for a com.sun.star.TextField.DropDown
Summary: The empty string is an (undocumented) invalid item for a com.sun.star.TextFie...
Status: CONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: OOo 2.0.3
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-04 10:13 UTC by clutz
Modified: 2017-05-20 11:26 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description clutz 2006-10-04 10:13:40 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
Comment 1 clutz 2006-10-04 10:25:26 UTC
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.
Comment 2 michael.ruess 2006-10-04 11:11:38 UTC
Reassigned to JSK.
Comment 3 joerg.skottke 2006-10-09 12:05:23 UTC
Sounds more API like -> cn
Comment 4 chne 2006-10-18 11:06:36 UTC
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.
Comment 5 chne 2006-10-18 11:27:29 UTC
cn->fs: for you
Comment 6 Frank Schönheit 2006-10-18 11:39:48 UTC
that's no form control, that's a text field.
Comment 7 Oliver Specht 2007-06-06 12:45:52 UTC
Set target to OOo Later
Comment 8 Marcus 2017-05-20 11:24:31 UTC
Reset assigne to the default "issues@openoffice.apache.org".
Comment 9 Marcus 2017-05-20 11:26:04 UTC
Reset assigne to the default "issues@openoffice.apache.org".