Apache OpenOffice (AOO) Bugzilla – Issue 110160
[From Symphony]The change event can't be triggered when changing the value of ComboBox, TextBox through VBA API.
Last modified: 2013-02-24 20:56:55 UTC
The change event can't be triggered when changing the value of ComboBox, TextBox through VBA API: 1. Open the sample file. 2. Click the button "Change ComboBox" or "Change TextBox". Expected: The change event for ComboBox or TextBox should be triggered. Issue: The change event is not triggered. Root cause: In method: UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ), there is a line: VclListenerLock aNoVclEventMultiplexing( pPeer ); This line will lock the listeners, that's why the change event is not triggered when we change the value of comboBox by VBA API. This code is added because of another issue: 14703. Solution 1: Remove the line: VclListenerLock aNoVclEventMultiplexing( pPeer ), that may change the behavior of OOo basic. Solution 2: Add a parameter to represent the value is set by VBA API. If this value is set by VBA API, then do not lock the listener. Noel, which solution do you prefer? Or do you have another solution?
Created attachment 68363 [details] Unit test case for this issue.
Created attachment 68553 [details] Test case for this issue
Created attachment 68554 [details] Patch for this issue
nice ( you fixed a bug in the orig fix ) but also you have deleted the click event generation, that is needed too
noel, do you mean the click event for ComboBox, it seems change the value of ComboBox does not trigger the click event in Excel, only trigger the change event, so I delete the click event generation.
really? it does for me ( mso xp, 2003 ) see attached doc, push the button see the events
Created attachment 68637 [details] test doc that demonstrates the click and change events
Created attachment 68656 [details] New Patch for this issue, fix the issue that Noel referred.
Noel, I found why my test case do not fire the click event when change the value of ComboBox. Because only when the new value is in the list of ComboBox, the click event is fired. In your test case, set "2" as the value of ComboBox, it is in the dropdown list of ComboBox, so click event is fired. There another issue in vbacombobox.cxx, ComboBox1.Value = 2 will cause a exception, because 2 is a integer value, so we must convert it to a String value firstly. I fix it in my new patch, please review it.
thanks for fixing the value as text issue, I only noticed that the document didn't work with openoffice much later ( and you beat me to fixing it ) otoh this document should make a good base for a regression test document the patch looks fine except ( hope I am reading the patch correctly ) it looks like now either a change event OR a click event will be fired, but really ( in the case of the attached document ) we need both a click AND change event ( not sure what the order is )
When call fireClickEvent(..), both click event and change event can be triggered. So we should call fireClickEvent(...) or fireChangeEvent(...).
>When call fireClickEvent(..), both click event and change event can be >triggered. So we should call fireClickEvent(...) or fireChangeEvent(...). I think what you mean is that fireChangeEvent will get fired automaticaly ( when setting the value to something in the list ) ok, if that is the case then that explains things :-) and then take it over and lets get it in :-)