Setting Mouse Cursor

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

TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Setting Mouse Cursor

Post by TatianaS »

hello,
I am poping my own right click menu after setting SetProperty('Notifications.Mouse.Skip', 'True', 0)
and it works great.
However when annotation is active or selected the mouse cursor switches to specific annotation cursor
and when I right click, the cursor does not reset to Arrow.
I tried to use CoPDFXCview.Cursor = crArrow, but it didn't work.
Is there a way to change mouse cursor?

Thanks,
-Tatiana
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Setting Mouse Cursor

Post by Stefan - PDF-XChange »

Hi Tatiana,

When you detect a right mouse button click call the GetSelectedAnnot() method. It will return -1 as it's first output parameter if no annotation is selected, and you can then proceed with ignoring the right button click and show your own context menu, and if an annotation is selected - you can use DeselectAll - ID 33248, and then show your context menu - this should keep your cursor to the default.

Cheers,
Stefan
TatianaS
User
Posts: 103
Joined: Mon Mar 18, 2013 4:26 pm

Re: Setting Mouse Cursor

Post by TatianaS »

Is it possible to keep annotation selected and change cursor to default on right click?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Setting Mouse Cursor

Post by Stefan - PDF-XChange »

Hi Tatiana,

I can think of "selecting the annotation back after closing the context menu" kind of solution, but will check with our devs to see if there's a more elegant one.

Regards,
Stefan
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Setting Mouse Cursor

Post by Vasyl - PDF-XChange »

Hi, TatianaS.
I tried to use CoPDFXCview.Cursor = crArrow, but it didn't work.
Is there a way to change mouse cursor?
Please try to use in your code:

Code: Select all

OnMouseRClick()
{
   HCURSOR hCurArrow = LoadCursor(NULL, IDC_ARROW);
   SetCursor(hCurArrow);

   ShowPopupMenu();
}
LoadCursor/SetCursor - are from system's API functions. IDC_ARROW == 32512.

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.