Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8837011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:37:19+00:00 2026-06-14T09:37:19+00:00

I am capturing mouse events inside of a shell with Composites by adding a

  • 0

I am capturing mouse events inside of a shell with Composites by adding a Filter.

For now the events are positioned relative to the Composites, where they occure.
How can I retrieve MouseEvents absolute position?
(Absolute position is the position with 0,0 in the left uper corner of the display).

parentShell.getDisplay().addFilter(SWT.MouseDown, new Listener() {
        @Override
        public void handleEvent(Event event) {
            //do not know the absolute position here
        }
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:37:20+00:00Added an answer on June 14, 2026 at 9:37 am

    You can use Control#toDisplay(int, int) to convert any relative coordinates to display relative absolute values.

    public void handleEvent(Event event) {
        if (event.widget instanceof Control) {
            Point absolutePos = ((Control) event.widget).toDisplay(event.x, event.y);
            ...
        }
    }
    

    The above will work if the event you received is a mouse event, which it is in your example. You can also use Display#getCursorLocation() at any point to get absolute mouse location if you do not have a mouse event at hand.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm capturing mouse position like this mouse_move: function(e) { mousePos.x = e.pageX - vr.o.context.canvas.offsetLeft;
I need a cross browser way of capturing the right mouse click, preventing the
when capturing events in the Automation event editor of Instruments (with the neat record
I am capturing some events in a C# program that come back with the
I am capturing click events on the body for a lightbox effect. Many lightboxes
How to get return value from mouse capturing function? function getMousePosition(e) { positionX =
I'm capturing the stderr of my script to I can later save to a
I have a screen capturing utility on which I can rubber band an area
I have a JavaScript code that is capturing mouse co-ordinates(X, Y and timestamps) from
I am having trouble capturing the hover enter and hover leave events in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.