Notifications.Mouse - TargetName

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

anovy
User
Posts: 164
Joined: Mon Feb 08, 2010 8:48 am

Notifications.Mouse - TargetName

Post by anovy »

What are all possible target names for mouse event notification? Unfortunately this is undocumented. So far I noticed only 'Pages' and 'Workspace' names. I need to distinguish between the document area (even if no document is opened) and the UI area (bars or other panes). However it seems that the 'Worskpace' name is used for the entire viewer area if no document is opened. So how can I detect a mouse event outside all UI elements when no document is opened? I have 'General.AllowOpenDocumentByDblClick' disabled and I want to make my own action if user double-clicks this area.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Notifications.Mouse - TargetName

Post by Vasyl - PDF-XChange »

The supported mouse target names:
"Pages",
"Comments",
"Bookmarks",
"Thumbnails",
"Fields",
"Layers",
"Attachments",
"Popup",
"Workspace".

In the new build you will be able to obtain advanced information about mouse target - the target window class name by:
GetProperty("Notifications.Mouse.TargetNameEx",...);
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.
anovy
User
Posts: 164
Joined: Mon Feb 08, 2010 8:48 am

Re: Notifications.Mouse - TargetName

Post by anovy »

So at the present I'm unable to distinguish between toolbar and the document area if no document is opened?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Notifications.Mouse - TargetName

Post by Vasyl - PDF-XChange »

Hmm.. You may use workaround (WinAPI, C++ code):

Code: Select all

POINT pt;
GetCursorPos(&pt);
HWND hWnd = WindowFromPoint(pt);
WCHAR szClassName[256] = {0};
GetClassNameW(hWnd, szClassName, 256);
if (lstrcmpiW(szClassName, L"MDIClient") == 0)
{
   // We are over MDI-Client(dark grey area, UI-container for documents) window exactly...
   ...
};
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.
anovy
User
Posts: 164
Joined: Mon Feb 08, 2010 8:48 am

Re: Notifications.Mouse - TargetName

Post by anovy »

Many thanks Vasyl, it works.

An additional question - is it possible to detect is the PDF viewer is in basic state? I mean here, that it is not in any editing state (for example markup etc.), where single-click performs some editing action (e.g. stamp)? I'm using the above code to enter full screen mode with double-click in the document area, however if the viewer is in some editing mode, then such action is not convenient, because it perfoms two things - first editing (e.g. stamp) and then full screen.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Notifications.Mouse - TargetName

Post by Vasyl - PDF-XChange »

Unfortunately, no simple way for this.
You may listen:
1. the annotation-focus changing (Notifications.Selection).
2. the text-editor start/stop events (Notifications.TextEditor).
For check annot-selection state you may(pseudocode):

Code: Select all

function bool HasFocusedAnnot()
{
    script = "var res = "false"; var selAnnots = this.selectedAnnots; if ((selAnnots != null)&&(selAnnots.length > 0)) res = "true"; res;"
    ax.RunJavaScript(script, result, 0, 0);
    return (result == "true");
}
For your case you may:
1. match the double click on the "Pages" target and start timer (interval > double-click interval, ~200 ms)
2. listen annotation-focus changing, text-editor start/stop events
3. on timer event: kill this timer, if was no these events between 1. and 3. then enter to full-screen mode.

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.