473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

ALT+F4 in MDI-Applications

Hello,

ALT+F4 is the shortcut to close a form.
When I use this shortcut in an MDI enviroment, the application is closed, so
obviously the shortcut applies to the 'Container' and not to the
'Childform'.
What would be the best practice to capture this event and close the active
child instead of the container (thus trying to end the application).

--
Thanks for helping,

Michael Maes

(I'm using vb.NET 2003 Enterprise Architect & SQL Server 2003 SP3)
Nov 20 '05 #1
7 2608
you could cancel the close event in the mdi parent and close the active
child there
if there are no childs close the main form

eric

"Michael Maes" <mi*****@merlot.com> wrote in message
news:OM**************@TK2MSFTNGP11.phx.gbl...
Hello,

ALT+F4 is the shortcut to close a form.
When I use this shortcut in an MDI enviroment, the application is closed, so obviously the shortcut applies to the 'Container' and not to the
'Childform'.
What would be the best practice to capture this event and close the active
child instead of the container (thus trying to end the application).

--
Thanks for helping,

Michael Maes

(I'm using vb.NET 2003 Enterprise Architect & SQL Server 2003 SP3)

Nov 20 '05 #2
its the closing event not the close event

"EricJ" <er********@THISomnipack.be> wrote in message
news:3f***********************@reader1.news.skynet .be...
you could cancel the close event in the mdi parent and close the active
child there
if there are no childs close the main form

eric

"Michael Maes" <mi*****@merlot.com> wrote in message
news:OM**************@TK2MSFTNGP11.phx.gbl...
Hello,

ALT+F4 is the shortcut to close a form.
When I use this shortcut in an MDI enviroment, the application is closed,
so
obviously the shortcut applies to the 'Container' and not to the
'Childform'.
What would be the best practice to capture this event and close the

active child instead of the container (thus trying to end the application).

--
Thanks for helping,

Michael Maes

(I'm using vb.NET 2003 Enterprise Architect & SQL Server 2003 SP3)


Nov 20 '05 #3
Hi Eric,

You could 'e.cancel' the 'closing-event' of the MDI-Form, but then you face
some problems:
What if you want to close the MDI-Form (close-button, menu, esc, or even
ALT+F4). (normally the user closes an application by closing the MDI, not
explicitly closing all the children first)
When you press ALT+F4 when a child has the focus, the event should happen in
the Childform, still the container closes. Does this mean the event is
captured by the containrform and does it know where the request came from
(sender). If that is the case you could cancel the event and close the
"requesting" child.

Michael

"EricJ" <er********@THISomnipack.be> wrote in message
news:3f***********************@reader1.news.skynet .be...
| you could cancel the close event in the mdi parent and close the active
| child there
| if there are no childs close the main form
|
| eric
|
| "Michael Maes" <mi*****@merlot.com> wrote in message
| news:OM**************@TK2MSFTNGP11.phx.gbl...
| > Hello,
| >
| > ALT+F4 is the shortcut to close a form.
| > When I use this shortcut in an MDI enviroment, the application is
closed,
| so
| > obviously the shortcut applies to the 'Container' and not to the
| > 'Childform'.
| > What would be the best practice to capture this event and close the
active
| > child instead of the container (thus trying to end the application).
| >
| > --
| > Thanks for helping,
| >
| > Michael Maes
| >
| > (I'm using vb.NET 2003 Enterprise Architect & SQL Server 2003 SP3)
| >
| >
|
|
Nov 20 '05 #4
"Michael Maes" <mi*****@merlot.com> schrieb
Hello,

ALT+F4 is the shortcut to close a form.
When I use this shortcut in an MDI enviroment, the application is
closed, so obviously the shortcut applies to the 'Container' and not
to the 'Childform'.
What would be the best practice to capture this event and close the
active child instead of the container (thus trying to end the
application).


To close the active child, use Ctrl+F4. That's the standard. Anything else,
IMHO, would only confuse the user.
--
Armin

Nov 20 '05 #5
"Know your Shortcuts...."
Thank you Armin,

Michael
"Armin Zingler" <az*******@freenet.de> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
| "Michael Maes" <mi*****@merlot.com> schrieb
| > Hello,
| >
| > ALT+F4 is the shortcut to close a form.
| > When I use this shortcut in an MDI enviroment, the application is
| > closed, so obviously the shortcut applies to the 'Container' and not
| > to the 'Childform'.
| > What would be the best practice to capture this event and close the
| > active child instead of the container (thus trying to end the
| > application).
|
| To close the active child, use Ctrl+F4. That's the standard. Anything
else,
| IMHO, would only confuse the user.
|
|
| --
| Armin
|
Nov 20 '05 #6
* "Michael Maes" <mi*****@merlot.com> scripsit:
ALT+F4 is the shortcut to close a form.
When I use this shortcut in an MDI enviroment, the application is closed, so
obviously the shortcut applies to the 'Container' and not to the
'Childform'.
What would be the best practice to capture this event and close the active
child instead of the container (thus trying to end the application).


This behavior is by design and I would not change it. You can use
Ctrl+F4 to close an MDI child.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #7
the ctrl f4 that armin and herfried suggested is of cource better. but if
you really want to use alt F4 i suppose you could build a controle structure
around it to check on wat form the user issued the close command.

"Michael Maes" <mi*****@merlot.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl...
Hi Eric,

You could 'e.cancel' the 'closing-event' of the MDI-Form, but then you face some problems:
What if you want to close the MDI-Form (close-button, menu, esc, or even
ALT+F4). (normally the user closes an application by closing the MDI, not
explicitly closing all the children first)
When you press ALT+F4 when a child has the focus, the event should happen in the Childform, still the container closes. Does this mean the event is
captured by the containrform and does it know where the request came from
(sender). If that is the case you could cancel the event and close the
"requesting" child.

Michael

"EricJ" <er********@THISomnipack.be> wrote in message
news:3f***********************@reader1.news.skynet .be...
| you could cancel the close event in the mdi parent and close the active
| child there
| if there are no childs close the main form
|
| eric
|
| "Michael Maes" <mi*****@merlot.com> wrote in message
| news:OM**************@TK2MSFTNGP11.phx.gbl...
| > Hello,
| >
| > ALT+F4 is the shortcut to close a form.
| > When I use this shortcut in an MDI enviroment, the application is
closed,
| so
| > obviously the shortcut applies to the 'Container' and not to the
| > 'Childform'.
| > What would be the best practice to capture this event and close the
active
| > child instead of the container (thus trying to end the application).
| >
| > --
| > Thanks for helping,
| >
| > Michael Maes
| >
| > (I'm using vb.NET 2003 Enterprise Architect & SQL Server 2003 SP3)
| >
| >
|
|

Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: waisty vb.net rookie | last post by:
How do I make sure my program cannot be closed by using Alt + F4 -- Thanks for reading
0
by: Ron James | last post by:
I have a Dialog type form that starts a worker thread, allows the thread to update its progess and provides a Cancel button. Following advice from Chad Meyers in a recent posting, the worker...
0
by: Stefan | last post by:
Hy, a have an application and i must disable the follow combination of keys: ALT+F4 ALT+TAB CTRL+ALT+DEL CTRL+ESC. For ALT+F4 i can disable the conbination with: protected override...
3
by: Stefan | last post by:
Hy, i have an app and i must disable this combination: ALT+F4; CTRL+ALT+DEL; CTRL+ESC;ALT+TAB like this: i find something on Internet and i can block ALT+F4 protected override...
3
by: 007 | last post by:
I have a FixedToolWindow form that I create and display when the user presses a button on the toolbar. I want to prevent Alt+F4 on the FixedToolWindow form. How do I accomplish this? I want the...
2
by: cashdeskmac | last post by:
I have written a small program and I want the user to close it down solely by clicking on a button. How can I disable the ALT+F4 method of closing the application down?
7
by: Nikki | last post by:
Hi, Can anybody help me, i want to prevent windows to close my winform of ..NET application, when user presses Alt+F4
5
by: freelancex | last post by:
Hi, Im new to this forum, and new to scripting in general. Im an ICT Technician for a high school and i am designing a Form in visual basic 2005. The intended purpose of the Form, is to prevent...
1
by: priya8014 | last post by:
can some one help me to disable alt+f4 using vb.net i have a code to disable alt+f4 using vb6.i did convert it to vb.net .how ever code is showing some error which i am not able to fix it . if any...
1
by: sambati | last post by:
Hi Guys, I want to execute script function for the following conditions , 1. when user press Alt+F4 key 2. from taskbar->rightclick-> close the browser option. But My html...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.