Bug 117849 - XGridSelectionListener is not working in python
Summary: XGridSelectionListener is not working in python
Status: NEEDINFO
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.1.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-28 08:59 UTC by Ηλίας Ηλιάδης
Modified: 2018-10-18 11:03 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ηλίας Ηλιάδης 2018-05-28 08:59:36 UTC
Based on https://ask.libreoffice.org/en/question/67644/looking-to-create-grid-not-table-control-on-base-form/ created a grid inside a dialog.

Tried to convert it to python but XGridSelectionListener is not triggered.

https://bugs.documentfoundation.org/attachment.cgi?id=142334 contains an example. The grid in dialog works perfect, but selecting any row in grid does not trigger the required function.

The "Companies" form contains a button with label "Test Dialog Grid" that will "poke" the value of the first column of the selected row (if OK is pressed).
Comment 1 Buovjaga 2018-06-28 10:46:50 UTC
(In reply to Ηλίας Ηλιάδης from comment #0)
> The "Companies" form contains a button with label "Test Dialog Grid" that
> will "poke" the value of the first column of the selected row (if OK is
> pressed).

What is the expected result after I click OK?
Comment 2 Ηλίας Ηλιάδης 2018-06-30 16:26:24 UTC
The ok works perfect. If you click in say the second row and then click OK the "Companies" form will receive the registration number from the first column of the selected row and will print 1: plus the registration number to the text box on the right of "Test Dialog Grid" button.

But the listener (a def inside the python class SomeListener) was supposed to show this "selected number" inside the dialog box instead of "HAS DATA" that shows initially.
Comment 3 Drew Jensen 2018-07-01 12:12:15 UTC
(In reply to Ηλίας Ηλιάδης from comment #2)
> The ok works perfect. If you click in say the second row and then click OK
> the "Companies" form will receive the registration number from the first
> column of the selected row and will print 1: plus the registration number to
> the text box on the right of "Test Dialog Grid" button.
> 
> But the listener (a def inside the python class SomeListener) was supposed
> to show this "selected number" inside the dialog box instead of "HAS DATA"
> that shows initially.

It doesn't work when you set it the way the script does do in the dialog model. I'm not sure that is right way to set that for a dialog though. 

So I changed the script and moved the place where the listener is added to after the dialog is instantiated with this:

dlg.createPeer(theWindow, None)
thelistener = SomeListener()
dlg.getControl("CompaniesGrid").addSelectionListener(thelistener)
response = dlg.execute()

But still the function SomeListener is never being called. Honestly I'm not sure if that is the right way to set that either, I'm trying to find the answer to that question.
Comment 4 Drew Jensen 2018-08-22 19:51:30 UTC
*** Bug 119427 has been marked as a duplicate of this bug. ***
Comment 5 Xisco Faulí 2018-10-18 11:03:07 UTC
Hello,
Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ after bug 119427 got fixed ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.