BBC BASIC for Windows
« Detecting that the window has been closed »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:56pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Detecting that the window has been closed  (Read 311 times)
simong42
New Member
Image


member is offline

Avatar




PM


Posts: 14
xx Detecting that the window has been closed
« Thread started on: Mar 13th, 2016, 1:18pm »

Next question :
I'm writing a program which will enable the user to design mazes, editing it with mouse clicks.
If the user clicks on the X button in the top-right corner, this ends the program - which is normally what I'd want.
However, in this case, there may be unsaved changes.

Is there any way of detecting the 'X' being clicked, so that I can put up an 'are you sure?' dialogue.
User IP Logged

Zaphod
Guest
xx Re: Detecting that the window has been closed
« Reply #1 on: Mar 13th, 2016, 1:51pm »

The answer is yes.
If we are talking about the main window or non-dialog windows then there is the ON CLOSE event which is designed to give you a chance to do something as the window is about to close.
If it is a dialog window then a WM_COMMAND message with an @wparam% value of 2 will be generated. To be able to trap that you will have to use WINLIB2B as WINLIB2 does not pass that onto the user but closes the dialog window automatically. With WINLIB2B the user has to close the dialog window after detecting the 2.

Here are some references that may help.
http://bbcbasic.co.uk/bbcwin/manual/bbcwin6.html#onclose
Quote:
The WINLIB2B library contains an identical set of functions but additionally forwards to your program any WM_HELP and WM_NOTIFY messages generated by the dialogue box controls. These messages can be intercepted using *SYS 1 to allow your program to provide, for example, context-sensitive help for your dialogue box. WINLIB2B also suppresses the automatic closing of the dialogue box when you click on its close button, or press Escape.
User IP Logged

simong42
New Member
Image


member is offline

Avatar




PM


Posts: 14
xx Re: Detecting that the window has been closed
« Reply #2 on: Mar 16th, 2016, 4:05pm »

Thanks, ON CLOSE is what I'm after for the main window
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls