Change Keyboard Shortcut behavior

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

marcoscmonteiro
User
Posts: 37
Joined: Thu Jan 01, 1970 12:00 am

Change Keyboard Shortcut behavior

Post by marcoscmonteiro »

I want to change some keyboard shortcuts behavior. For example: Commands["ActualSize"].Shortcut.Key uses CTRL+0 and I would like CTRL+1 imitating Adobe Reader. I tried to set Commands[""ActualSize""].Shortcut.Key without success.

I also tried to capture keyboard event and change keyboard behavior but PDFXChange freezes when I execute new command even if I use "Notifications.Keyboard.Skip" = 1 at the of event treatment.

Another way? Any chance to do this?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Change Keyboard Shortcut behavior

Post by Vasyl - PDF-XChange »

I want to change some keyboard shortcuts behavior. For example: Commands["ActualSize"].Shortcut.Key uses CTRL+0 and I would like CTRL+1 imitating Adobe Reader. I tried to set Commands[""ActualSize""].Shortcut.Key without success.
The code-snippet:

Code: Select all

// set CTLT+'1' for 'ActualSize' command
pdfViewer.SetProperty("Commands[\"ActualSize\"].Shortcut.Modifiers", 0x08); // standard windows FCONTROL constant (winuser.h)
pdfViewer.SetProperty("Commands[\"ActualSize\"].Shortcut.Key", 0x31); // '1'
// to resolve conflict with existing the same shortcut set CTLT+'0' for 'FitPage' command:
pdfViewer.SetProperty("Commands[\"FitPage\"].Shortcut.Modifiers", 0x08);
pdfViewer.SetProperty("Commands[\"FitPage\"].Shortcut.Key", 0x30); // '0'
I also tried to capture keyboard event and change keyboard behavior but PDFXChange freezes when I execute new command even if I use "Notifications.Keyboard.Skip" = 1 at the of event treatment.
Do not call 'ExecuteCommand' directly inside your 'OnEvent'-handler. Make it asynchronously (by PostMessage, fast timer, etc.).

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
marcoscmonteiro
User
Posts: 37
Joined: Thu Jan 01, 1970 12:00 am

Re: Change Keyboard Shortcut behavior

Post by marcoscmonteiro »

Thanks! It works!

I was not setting "Commands[""ActualSize""].Shortcut.Modifiers" ...
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Change Keyboard Shortcut behavior

Post by Stefan - PDF-XChange »

:)