By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,684 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,684 IT Pros & Developers. It's quick & easy.

ALT+F4 in MDI-Applications

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
"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

P: n/a
* "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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.