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 6344111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:34:26+00:00 2026-05-24T20:34:26+00:00

I found this question on Experts-Exchange . Control’s OnExit eats up mouseup event for

  • 0

I found this question on Experts-Exchange.

Control’s OnExit eats up mouseup event for new control when showing
another window

The problem can be replicated easily.

place 3 tedits on a form. write a showmessage(‘exit’) in edit1’s
onexit event run the program give edit1 focus use the mouse to give
edit3 focus, click ok to the showmessage observe how you can’t write
anything in edit3 now, until you click with the mouse somewhere on the
form ! give edit2 focus, then use to the mouse to give edit3 focus
observe how you can type what you want in edit3 now !

So far I’ve established that the problem lies in the fact that edit3
doesn’t receive a mouseup-message when the old controls onExit event
displays a window of any kind, i’ve tried it as well with showing a
form of my own in the onExit event, same result. In fact, windows is
under the impression that the mouse is held down over edit3 after
you’ve clicked Ok to the showmessage

I guess it’s a bug in Delphi/Windows but how to work around it ? I
know i can force a WM_LBUTTONUP on edit3’s onMouseDown event (since
its the last event called in the process) but that’s more than
tedious, and not always applicable

I am trying to do something similiar:

In the onexit event I show a warningbox and then want to proceed
as normal – moving the focus to where the user in fact clicked.
Is that possible?

  • 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-05-24T20:34:27+00:00Added an answer on May 24, 2026 at 8:34 pm

    Once again PostMessage to the rescue! Defer your dialog just a little bit longer so that Windows can finish its focus change. Post yourself a message instead of showing the dialog directly:

    const
      WM_SHOWMYDIALOG = WM_APP + 321;
    
    TForm1 = class(TForm)
      Edit1: TEdit;
      Edit2: TEdit;
      procedure Edit1Exit(Sender: TObject);
    private
      procedure WMSHOWMYDIALOG(var Message: TMessage); message WM_SHOWMYDIALOG;
    end;
    
    procedure TForm1.Edit1Exit(Sender: TObject);
    begin
      PostMessage(Self.Handle, WM_SHOWMYDIALOG, 0, 0);
    end;
    
    procedure TForm1.WMSHOWMYDIALOG(var Message: TMessage);
    begin
      ShowMessage('Nice one');
    end;
    

    And everything is fine 🙂

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

Sidebar

Related Questions

Reading this question I found this as (note the quotation marks) code to solve
I found this question in an old question in your website so i thought
I found this question that is discussing what I would like to do, but
I found this question that was very useful in learning the basics of the
I found this question which is a great starting point towards creating embedded widgets
I found this question but it was only similar and, more importantly, dated by
I searched and found this question but did not like the answer. Is there
I haven't found this question, feel free to close if it's already up here.
I found this related question: How do I use composition with inheritance? I would
I found this open question online. How do you process a large data file

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.