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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:01:22+00:00 2026-05-11T16:01:22+00:00

In my Delphi application I have a custom Yes, No, Cancel dialogue, which will

  • 0

In my Delphi application I have a custom Yes, No, Cancel dialogue, which will be called from the main form to confirm saving the changes made to the current file edited. This would normally be achieved by messageDlg() but I wanted this dialogue to have customised looks, so I am trying to achieve this functionality by

case myDialogue.showModal of
  mrYes: <<save changes>>;
  mrNo: <<quit application without saving changes>>
  mrCancel: <<set the closeAction to caNone and do nothing>>
end;

The problem is that, by default, the form reacts to pressing the Escape key by returning mrNo TModalResult. And you can see how BAAAD this is, since your intuition tells you that Esc-aping the modal dialogue will CANCEL the intended Quit Application process, but in fact what happens is you issue a Don’t save any changes command and application quits.

I have not noticed this behaviour until I lost an hour’s work in this fashion. No FormKeyPressed event handler or anything responding to key presses was put into the myModalDialogue code. It just so works that pressing the Esc in forms shown using showModal will return mrNo. How can I override this default behaviour?

  • 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-11T16:01:22+00:00Added an answer on May 11, 2026 at 4:01 pm

    You need to make sure that the Cancel property of the “No” button is False, and that the Cancel property of the “Cancel” button is True.

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

Sidebar

Related Questions

I have a Delphi application which reads data from an excel spreadsheet using code
I have an application written in Delphi 7 which does not require an admin
We have a large (about 580,000 loc) application which in Delphi 2006 builds (on
I have an application, where there are many forms which follow visual form inheritance.
I have customer that uses older, custom built ERP application for which they don't
I have a 32bit Delphi application which needs to use Redemption to talk with
I have old Delphi application. This app takes session key from server, do some
I have a Delphi application using DevExpress cxGrid (which is connected to database). I
I have a Delphi application which contains a manifest file with a few dependencies
I have an application in Delphi 7 which is using a clientdataset, and make

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.