Catch event immediately before XGridSelectionListener?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Catch event immediately before XGridSelectionListener?

Post by joesch »

Hello,

for the grid ("com.sun.star.awt.grid"), when its selection changes, is there a possibility to read the previous selection?
My thought is to use a listener whose event occurs immediately before that of the XGridSelectionListener, but in find None. For example the XMouseListener triggers only after the XGridSelectionListener.

Note:
I know that I can save the last selection (I mean the value of .CurrentRow) in a variable and then, when changing the selection, read the variable before changing the value of the variable again. But maybe there is a direct way via an event.



greetings,
Jörg
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Catch event immediately before XGridSelectionListener?

Post by JeJe »

If this is a grid control in a dialog and what you want to do is beyond what it allows - then, it may be too involved for you, but my approach would be to create my own control using labels. A grid control is similar to a grid of label controls.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Catch event immediately before XGridSelectionListener?

Post by joesch »

JeJe wrote:If this is a grid control in a dialog and what you want to do is beyond what it allows - then, it may be too involved for you, but my approach would be to create my own control using labels. A grid control is similar to a grid of label controls.
This would be much more complicated than the possible alternative solution I had already mentioned myself:

"I know that I can save the last selection (I mean the value of .CurrentRow) in a variable and then, when changing the selection, read the variable before changing the value of the variable again. But maybe there is a direct way via an event."


greetings,
Stephan
JeJe
Volunteer
Posts: 2779
Joined: Wed Mar 09, 2016 2:40 pm

Re: Catch event immediately before XGridSelectionListener?

Post by JeJe »

Yeah, much more involved, I'm throwing it out there as another option as people sometimes don't think of it... I've written controls based on labels countless times... and its not always all that difficult.

I looked and couldn't find what you're asking for... though not exhaustively... I presume you've used MRI and gone through everything you can see there?

Your post was disappearing down the page... sometimes several years later someone answers a post with a solution... but its not looking good for what you want being available from the people here right now... if its possible...

The best place to store that selection information might be the tag property of the control.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
joesch
Posts: 53
Joined: Mon Apr 20, 2020 9:49 am
Location: Germany, near Berlin

Re: Catch event immediately before XGridSelectionListener?

Post by joesch »

Yes, I searched with the XRAYTool.


greetings,
Stephan
Attachments
XRAYTool.gif
Post Reply