see bug inherited from OOo: http://www.openoffice.org/issues/show_bug.cgi?id=104788 .
It is about 1.5 years old and inhibits extension developers (like me) from using the Dropdownbox in the toolbar.
There is only ONE line that has to be changed according to the api mailing list and that bug report is below:
--- framework/source/uielement/dropdownboxtoolbarcontroller.cxx (revision 274324)
+++ framework/source/uielement/dropdownboxtoolbarcontroller.cxx (working copy)
@@ -222,7 +222,7 @@
xDispatch = getDispatchFromCommand( m_aCommandURL );
aCommandURL = m_aCommandURL;
aTargetURL = getInitializedURL();
- aSelectedText = m_pListBoxControl->GetText();
+ aSelectedText = m_pListBoxControl->GetSelectEntry();
In an extension one can design an own toolbar, that might contain this dropdownbox.
When this value is changed the extension gets notified via a dispatch through the above procedure.
The "aSelectedText" should contain the text content of the newly selected dropdownbox item, but due to this bug just returns an empty string.
So the extension does not know which item was selected.
My current work around: using ToggleDropdownButton (not as nice in this circumstance)
Yeah, as far as I can tell m_pListBoxControl wraps a vcl ListBox which inherits from vcl Control which inherits from vcl Window and nothing under Window overrides GetText so its doesn't seem to make sense to call GetText here as that would likely always return an empty string. GetSelectEntry on the other hand would do something seemingly sensible.
That said, this code has changed a lot since the bug was reported. Do you have any demonstration code for this to test it ?, especially because I see various other GetText calls in that dir that may or may not be right.
Tentatively changed the GetText to GetSelectEntry in that file for now (3.4 onwards)
Created attachment 44593 [details]
Test Extension making use of DropdownBox
Install the extension, run it, change the value of "Table" or "Cell", a dialogbox pops up with "value of Text" then the Text of that field embedded in ":". Currently (LO 3.3.1) its an empty string.
Created attachment 44594 [details]
Sourcecode with entire Netbeans project
The file in question is BL_TB_ApplyToBTn.java.
first builds of 3.4 are due inside a couple of weeks.