Issue 110160 - [From Symphony]The change event can't be triggered when changing the value of ComboBox, TextBox through VBA API.
Summary: [From Symphony]The change event can't be triggered when changing the value of...
Status: CONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: vba (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P2 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-16 08:17 UTC by lihuiibm
Modified: 2013-02-24 20:56 UTC (History)
1 user (show)

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


Attachments
Unit test case for this issue. (33.50 KB, text/plain)
2010-03-16 08:18 UTC, lihuiibm
no flags Details
Test case for this issue (60.00 KB, text/plain)
2010-03-26 04:26 UTC, lihuiibm
no flags Details
Patch for this issue (4.32 KB, text/plain)
2010-03-26 04:27 UTC, lihuiibm
no flags Details
test doc that demonstrates the click and change events (34.50 KB, text/plain)
2010-03-30 14:03 UTC, noel.power
no flags Details
New Patch for this issue, fix the issue that Noel referred. (5.10 KB, patch)
2010-03-31 04:14 UTC, lihuiibm
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description lihuiibm 2010-03-16 08:17:11 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?
Comment 1 lihuiibm 2010-03-16 08:18:40 UTC
Created attachment 68363 [details]
Unit test case for this issue.
Comment 2 lihuiibm 2010-03-26 04:26:07 UTC
Created attachment 68553 [details]
Test case for this issue
Comment 3 lihuiibm 2010-03-26 04:27:02 UTC
Created attachment 68554 [details]
Patch for this issue
Comment 4 noel.power 2010-03-29 14:40:40 UTC
nice ( you fixed a bug in the orig fix )
but also you have deleted the click event generation, that is needed too
Comment 5 lihuiibm 2010-03-30 12:24:52 UTC
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.
Comment 6 noel.power 2010-03-30 14:03:02 UTC
really? it does for me ( mso xp, 2003 ) see attached doc, push the button see
the events 
Comment 7 noel.power 2010-03-30 14:03:49 UTC
Created attachment 68637 [details]
test doc that demonstrates the click and change events
Comment 8 lihuiibm 2010-03-31 04:14:30 UTC
Created attachment 68656 [details]
New Patch for this issue, fix the issue that Noel referred.
Comment 9 lihuiibm 2010-03-31 04:14:55 UTC
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.
Comment 10 noel.power 2010-04-01 10:43:23 UTC
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 )  
Comment 11 lihuiibm 2010-04-01 10:51:07 UTC
When call fireClickEvent(..), both click event and change event can be
triggered. So we should call fireClickEvent(...) or fireChangeEvent(...).
Comment 12 noel.power 2010-04-01 11:52:56 UTC
>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 :-)