read mouse position on doubleclick  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
RoGraf
User
Posts: 13
Joined: Tue Mar 20, 2018 10:39 am

read mouse position on doubleclick

Post by RoGraf »

Hi,

we actually use the Viewer SDK (OLE-Embedded) and we plan to switch to the new Editor. One of the Functions is to catch the doubleclick of the user and deliver the mouse possition to the embedding application.

We used the notifications by reading the property "Notifications.Mouse.x" and "Notifications.Mouse.y" on event.
Now we need the same functionality with the Editor. Is there e chance to
1. catch the Mouse-Click/Doubleclick
2. read the Mouse position

using the PDFXChange Editor SDK?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: read mouse position on doubleclick

Post by Sasha - Tracker Dev Team »

Hello RoGraf,

Check out this sample:
https://gist.github.com/Polaringu/f3de7 ... 65695e364c

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RoGraf
User
Posts: 13
Joined: Tue Mar 20, 2018 10:39 am

Re: read mouse position on doubleclick

Post by RoGraf »

Sasha - Tracker Dev Team wrote:Hello RoGraf,

Check out this sample:
https://gist.github.com/Polaringu/f3de7 ... 65695e364c

Cheers,
Alex
Hi Alex,

thank you for the quick Response. I already knew this example, but we have a special situation - I fogott to mention - sorry.

We use the viewer (and potentially the editor) within the RPC/SWT envionment - its just embedded in an OLE-Frame and it works fine since we generated a JNA-representation of the Libs.
The problem in my case is the event - I registered for the "e.pagesView.mouse" Event an now get all the mouse Actions. This event comes (as specified here: https://sdkhelp.pdf-xchange.com/vi ... View_mouse) with the "Param1" property containing the Event-Code (e.g. 513 for WM_LBUTTONDOWN) but Param2 does not contain the Position - the (double)value does not change as I move the mouse.
Is there any chance to get the mouse position the way it is mentioned in the example?

CU
RoGraf
User
Posts: 13
Joined: Tue Mar 20, 2018 10:39 am

Re: read mouse position on doubleclick

Post by RoGraf »

Any idea, how to get the event details in the ActiveX/OLE environment??
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: read mouse position on doubleclick

Post by Sasha - Tracker Dev Team »

Hello RoGraf,

You will have to do just like you can see in the provided sample - create a custom event target for the pages view - that should work.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RoGraf
User
Posts: 13
Joined: Tue Mar 20, 2018 10:39 am

Re: read mouse position on doubleclick

Post by RoGraf »

Hi Alex,

this is not possible - as I told, we are using RCP/SWT (Java) environment. Actually I found no way to register a Java-Structure as EventHandler. The C# Code is not usefull in our environment.
I get the OleEvent, when registering to the mouse-actions-event "e.pagesView.mouse" and it is containing the Mouse-Button or movement-Codes but not the Postion.
My Question ist, what kind of data comes with the Param2-Parameter?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: read mouse position on doubleclick  SOLVED

Post by Sasha - Tracker Dev Team »

Hello RoGraf,

I've updated the description to that event - now it should be clear:
https://sdkhelp.pdf-xchange.com/vi ... View_mouse

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
RoGraf
User
Posts: 13
Joined: Tue Mar 20, 2018 10:39 am

Re: read mouse position on doubleclick

Post by RoGraf »

Hi Alex, thank you verry much - now I managed getting the complete Event:
EXAMPLE for reading Mouse-Position in Viewer for OleEvent "e.pagesView.mouse" using JNA-generated framework (using martin3 's tool viewtopic.php?f=66&t=30142&p=122393&hilit=jna#p122393 ):

Code: Select all

private void evaluateMouseEvent(OleEvent pEvent) {
	Variant[] vs = pEvent.arguments;
        OleAutomation event = vs[1].getAutomation();
	int[] codeID = event.getIDsOfNames(new String[] { "Param1" });
	int codeIdMember = codeID[0]; // --> Code for button clicked
	Variant codeVariant = event.getProperty(codeIdMember);
	int eventType = codeVariant.getInt(); // e.g. 512 for mouse move
	int[] coordinatesID = event.getIDsOfNames(new String[] { "Param2" });
	int coordIdMember = coordinatesID[0]; 
	Variant coordVariant = event.getProperty(coordIdMember);
	double uk = coordVariant.getDouble();
	Pointer ptr = new Pointer((long) uk);
	IUIX_Event ev = new IUIX_Event(ptr); // Now we have the IUIX_Event
        ULONG_PTR ptr2 = ev.Param2();
	short x = LowWord(ptr2.longValue()); // mouse position X for action
	short y = HighWord(ptr2.longValue());  // mouse position Y for action
	codeVariant.dispose();
	coordVariant.dispose();
 }
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: read mouse position on doubleclick

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply