How do I get what key is pressed from e.pagesView.keyboard?

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.
stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

How do I get what key is pressed from e.pagesView.keyboard?

Post by stephen.starr »

In the pages view I want to get what key was pressed in the "e.pagesView.keyboard" event. It looks like it is fired 3 times, 256 - KEY_DOWN, 257 = KEY_UP, and 258 = KEY_PRESS?

But I cannot find out how to tell which key was pressed.

Thank you,
Stephen
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: How do I get what key is pressed from e.pagesView.keyboa

Post by Sasha - Tracker Dev Team »

Hello Stephen,

Here's the code snippet on how you can get to the WM_KEYDOWN event:

Code: Select all

if (e.nEventID == nIDS[(int)IDS.e_pagesView_keyboard])
{
	IntPtr outPtr = new IntPtr(e.pEvent.Param2);
	PDFXEdit.IUIX_Event evt = (PDFXEdit.IUIX_Event)System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(outPtr);
	if (evt.Code == 0x0100) //#define WM_KEYDOWN	0x0100
	{
		//Here you have the WM_KEYDOWN message with it's wParam and lParam as Param1 and Param2
	}
}
Here's the link to the event description:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
stephen.starr
User
Posts: 123
Joined: Wed Mar 25, 2015 10:59 pm

Re: How do I get what key is pressed from e.pagesView.keyboa

Post by stephen.starr »

Perfect, thank you Alex.

Appreciate your help.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London

Re: How do I get what key is pressed from e.pagesView.keyboa

Post by Tracker Supp-Stefan »

:)
cew
User
Posts: 213
Joined: Tue Feb 01, 2011 8:14 am

Re: How do I get what key is pressed from e.pagesView.keyboa

Post by cew »

Hi there,

I also need to know what key (System.Windows.Forms.Keys, System.Windows.Forms.Control.ModifierKeys) or combintaion has been pressed.
It is not familiar to me to work with WM_KEYDOWN.
I can't debug the evt.Code of your example. Visual Studio just shows nothing :-(

Could you please fill your curly braces with an example?

Code: Select all

   {
      //Here you have the WM_KEYDOWN message with it's wParam and lParam as Param1 and Param2
   }
Best regards,
cew
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: How do I get what key is pressed from e.pagesView.keyboa

Post by Sasha - Tracker Dev Team »

Hello cew,

In the previous post, I've provided a link to the msdn page where the WM_KEYDOWN event is described. Here's a screenshot from my VS:
Image

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
cew
User
Posts: 213
Joined: Tue Feb 01, 2011 8:14 am

Re: How do I get what key is pressed from e.pagesView.keyboa

Post by cew »

Hi Alex,

is it possible that I can't see anything because I do not have *.dbg-files?

Best regards,
cew
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am

Re: How do I get what key is pressed from e.pagesView.keyboa

Post by Sasha - Tracker Dev Team »

Hello cew,

You can try and pass this information to the Output or to some list control to see the values.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ