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

  • Home
  • SEARCH
  • 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 7845535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:15:25+00:00 2026-06-02T17:15:25+00:00

Is it possible to check when the user has clicked outside a modal window?

  • 0

Is it possible to check when the user has clicked outside a modal window? I’d like to somehow circumvent the modal logic because if the window isn’t displayed as modal, it will not be shown on top of the active window, and, for now, this is the only way to display it correctly. I haven’t found a proper way to do just that (since the “deactivate” event will no longer be triggered..)

  • 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-02T17:15:28+00:00Added an answer on June 2, 2026 at 5:15 pm

    Even if it’s a modal window (displayed with ShowDialog() calls), one can add some even handlers to the window’s class and make it check for the mouse clicks outside the window like this:

        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (posX < 0 || posX > this.Width || posY < 0 || posY > this.Height)
                this.Close();            
        }
    
        private void Window_MouseMove(object sender, MouseEventArgs e)
        {
            Point p = e.GetPosition(this);
    
            posX = p.X; // private double posX is a class member
            posY = p.Y; // private double posY is a class member
        }
    
        private void Window_Activated(object sender, EventArgs e)
        {
            System.Windows.Input.Mouse.Capture(this, System.Windows.Input.CaptureMode.SubTree);
        }
    

    This did the job for me, in a difficult context: mingled MFC, WindowsForms mammoth of an app – no interop, no other complicated stuff. Hope it helps others facing this odd behavior.

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

Sidebar

Related Questions

Is it possible for canvas to check if user has liked a certain page
Is it possible to check if the browser user has opened a new tab,
Is it possible to check if the user has a sound card? I found
Possible Duplicate: Facebook how to check if user has liked page and show content?
Is it possible to check whether a browser-provided function has been replaced by user
is it possible to check (with PHP) if the browser supports SVG? like ...
How can i check that a user has input a url into the terminal
Is it possible to check on startup of an Android app whether the user
My question is as follows; I am trying to check if a user has
I'm currently looking for a way, to check if a user has uploaded files

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.