Bug 119427 - The selectionChanged event of the com.sun.star.awt.grid.XGridSelectionListener interface does not work with mouse clicks.
Summary: The selectionChanged event of the com.sun.star.awt.grid.XGridSelectionListene...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: All All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:6.2.0 target:6.1.1
Keywords: bibisected, regression
Depends on:
Blocks:
 
Reported: 2018-08-22 18:27 UTC by Silvio Antonio Teston
Modified: 2018-08-25 18:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file with macro example code. (11.01 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-08-22 20:33 UTC, Silvio Antonio Teston
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Silvio Antonio Teston 2018-08-22 18:27:54 UTC
Description:
I'm using the listener with the model com.sun.star.awt.grid.UnoControlGridModel. My macro is written in BASIC. With version 6.1.0.3 the selectionChanged of com.sun.star.awt.grid.XGridSelectionListener is not invoked when the user selects a row. Pressing up or down arrow keys the row selected changes and the event selectionChanged is invoked. When the user changes the selection using the left mouse click the event is not invoked.
With LO version 6.0.6 (stable version) the event is properly invoked. The problem was first seen in version 6.1.0.3.

Steps to Reproduce:
1.Create a new dialog and add a com.sun.star.awt.grid.UnoControlGridModel
2.Add a listener com.sun.star.awt.grid.XGridSelectionListener to the grid control 
3.Add a routine to treat selectionChanged() event
4. Fill the grid with some rows
5. Run the macro and show the dialog
6. Select rows using mouse. The event is not invoked.
7. Using up or down arrow keys the envent is invoked.

Actual Results:
Event selectionChanged() is not responding to mouse clicks.

Expected Results:
The event selectionChanged should be invoked every time a selection has changed, but it doesn't.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
When the user changes the selection with a mouse click, the event selectionChanged should be called.
Comment 1 Drew Jensen 2018-08-22 19:48:36 UTC
Different scripting language but looks like a duplicate of 
https://bugs.documentfoundation.org/show_bug.cgi?id=117849
"XGridSelectionListener is not working in python"
Comment 2 Drew Jensen 2018-08-22 19:51:30 UTC
@Silvio I am going to mark this as a duplicate, change the other issue to new and change the summary to reflect it is an API problem not a script language issue.

Any chance you could put up an example with your basic routine included and attach it to the other issue?

*** This bug has been marked as a duplicate of bug 117849 ***
Comment 3 Drew Jensen 2018-08-22 19:55:38 UTC
@Silvio sorry for the confusion I re-read the other issue and this one and I think I was wrong about seeing them as duplicates. Reverting that.

Again, if you have an example it would make it faster to confirm.
Comment 4 Silvio Antonio Teston 2018-08-22 20:33:02 UTC
Created attachment 144376 [details]
Test file with macro example code.
Comment 5 Silvio Antonio Teston 2018-08-22 20:36:04 UTC
Drew, please see the attachment. The LO Calc file has a macro called ShowDialog(). The macro displays a dialog with a grid control with five rows. When the selection is changed you'll see a message box. Here, the event never happens using left mouse button. But, when I use the keyboard up or down arrow keys, the message box is displayed.
Thank you!
Comment 6 Drew Jensen 2018-08-22 20:53:33 UTC
Confirmed the anomaly is present in 6.1.0.3 and 6.2Alpha, running under Ubuntu 18.04.

It is not present in 6.0.5 (also Ubuntu)

Will start with a bibisect against the 6.1 repo.
Comment 7 Drew Jensen 2018-08-22 21:18:45 UTC
results from bibsect in 6.1 Repo show that anomaly arrived with commit: 0fb4ae8767fa5ff791cd42934b4215011a269eb0

"Modernize a bit svtools"
by using for-range loops
+ use empty() instead of comparing begin and end iterator

Effects 23 source files. (includes dialog controller and control controllers)

Author: Julien Nabet (adding to CC)
Comment 8 Julien Nabet 2018-08-23 08:39:27 UTC
Argh, I'll take a look but it's not gonna be easy considering the size of the patch.

Anyway thank you Drew for the bibisect and for having put me in cc.
Comment 9 Julien Nabet 2018-08-23 19:45:23 UTC
I confirm reverting 0fb4ae8767fa5ff791cd42934b4215011a269eb0 (+quick and dirty fix conflicts) fixes the pb.
Now I can begin the tedious part to find the bug.
Comment 10 Julien Nabet 2018-08-23 20:23:00 UTC
I submitted https://gerrit.libreoffice.org/#/c/59526/ on gerrit.
The msgbox appears when clicking with this.

But I noticed that clicking on "OK" button didn't work.
So I think there's probably another bug here.
Comment 11 Julien Nabet 2018-08-23 20:29:31 UTC
(In reply to Julien Nabet from comment #10)
> ...
> But I noticed that clicking on "OK" button didn't work.
> So I think there's probably another bug here.

It seems related to gtk3 rendering.
With gen or gtk rendering, clicking OK works.
Comment 12 Commit Notification 2018-08-23 21:28:14 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=36123b42c5d3084f94d068874a0bac2cc849a66e

tdf#119427: fix selectionChanged event

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Drew Jensen 2018-08-23 21:36:19 UTC
(In reply to Commit Notification from comment #12)
> Julien Nabet committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=36123b42c5d3084f94d068874a0bac2cc849a66e
> 
> tdf#119427: fix selectionChanged event
> 
> It will be available in 6.2.0.
> 
> The patch should be included in the daily builds available at
> http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
> information about daily builds can be found at:
> http://wiki.documentfoundation.org/Testing_Daily_Builds
> 
> Affected users are encouraged to test the fix and report feedback.

That was fast. Thanks.

Will check it out (with gen and GTK) using daily build tomorrow.
Comment 14 Commit Notification 2018-08-24 07:08:41 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=29e5a7cc352e54570d512007421a550cab42d361&h=libreoffice-6-1

tdf#119427: fix selectionChanged event

It will be available in 6.1.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Julien Nabet 2018-08-24 07:11:51 UTC
Thank you Silvio for having filling a bug about this and Drew for bibisection and ping, it allows me to fix a nasty regression due to me.
Comment 16 Silvio Antonio Teston 2018-08-24 11:28:18 UTC
Thank you Julien and Drew. You were very quick to confirm the bug and resolve it. As soon as I test a new version I will post the results here. Many thanks.
Comment 17 Silvio Antonio Teston 2018-08-25 18:10:47 UTC
I did a test with LO version 
Version: 6.1.1.0.0+ 
Build ID: 29e5a7cc352e54570d512007421a550cab42d361 
and the selectionChanged() event was invoked with mouse clicks and keyboard.
I confirm that the problem has been resolved. Thank you.