Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Get the point of my mouse click position

New Here ,
Nov 26, 2008 Nov 26, 2008

Copy link to clipboard

Copied

How do I get the x and y of where my mouse click is???
TOPICS
SDK

Views

1.0K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Nov 26, 2008 Nov 26, 2008

Copy link to clipboard

Copied

This is a tricky one. If you've written a tool plugin, then you can receive events about mouse clicks & drags, but only if you tool is selected. If you want to receive this information at any given time, the answer is "you can't"...at least not with the API.

It is possible to use the OS to catch mouse movement and clicks, though you'll have to catch the document opened notifier and hook into the right window to get the events. This is fairly straight forward to do with Spy++ on Windows (not sure what the equivalent on Mac is) in order to figure out what the window structure is, at least until CS3. After that, CS4 is a mess to figure out -- there are so many permutations of window organizations because you can have tabbed or not-tabbed or floating-tabbed documents. We actually hook into to this kind of functionality through the OS to get mouse movements and while it does work (and not terribly hard), we haven't got it 100% on CS4.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 26, 2008 Nov 26, 2008

Copy link to clipboard

Copied

I am going to write a tool plugin, understand that I could receive mouse event, but how am mi going to retrieve my x and y ???

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 27, 2008 Nov 27, 2008

Copy link to clipboard

Copied

LATEST
Hi,

I wrote a few tools plugins for Illustrator. http://perso.orange.fr/jlg.outils

To make a new tool added to the Illustrator toolbox, you have to use the AIToolMessage structure.
In this structure, you find the mouse coordinates. Look into AITool.h.

This structure is used by toolMouseDown, toolMouseDrag, toolTrackCursor, toolSelect, toolMouseUp, toolDeselect.

For instance,

extern AIErr toolTrackCursor( AIToolMessage *message )
{AIErr error = kNoErr;
AIRealPoint myPos;

//When your tool is selected and
//each time, your mouse moves, myPos contain your mouse position.
myPos.h=message->cursor.h;
myPos.v=message->cursor.v;
...
}

JLG.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines