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

Adapting menu if child is opened

P: n/a
I have a main form (an mdi container) with a menu and the item "open".
When clicking "open" a child form appears. Now, i don't want that
several childforms are opened. So i want the "open" item to be
disabled when this child form is shown. When i close this child form
i want the "open" item in the menu to be enabled again so that i can
open the child form whenever i want. How can i do this? Anyone an
idea?

thx.
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
"Kenny" <ge*******@hotmail.com> schrieb
I have a main form (an mdi container) with a menu and the item
"open".
When clicking "open" a child form appears. Now, i don't want
that
several childforms are opened. So i want the "open" item to be
disabled when this child form is shown. When i close this child
form i want the "open" item in the menu to be enabled again so that i
can open the child form whenever i want. How can i do this? Anyone
an idea?


In the menuitem's click event, set it's enabled property to false (that's
what you probably aready know). After creating the instance of the child
within the MDI container, use the Addhandler statement to handle the closed
event of the child. In the event handler, enable the menuitem.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
"Armin Zingler" <az*******@freenet.de> wrote in message news:<uJ**************@TK2MSFTNGP11.phx.gbl>...
"Kenny" <ge*******@hotmail.com> schrieb
I have a main form (an mdi container) with a menu and the item
"open".
When clicking "open" a child form appears. Now, i don't want
that
several childforms are opened. So i want the "open" item to be
disabled when this child form is shown. When i close this child
form i want the "open" item in the menu to be enabled again so that i
can open the child form whenever i want. How can i do this? Anyone
an idea?


In the menuitem's click event, set it's enabled property to false (that's
what you probably aready know). After creating the instance of the child
within the MDI container, use the Addhandler statement to handle the closed
event of the child. In the event handler, enable the menuitem.


Can you give me some more information cause i don't quite understand.
This handling stuff isn't really my bag.
Nov 20 '05 #3

P: n/a
"Kenny" <ge*******@hotmail.com> schrieb
Can you give me some more information cause i don't quite understand.
This handling stuff isn't really my bag.

In the menuitem's click event, set it's enabled property to false (that's
what you probably aready know).
directcast(sender, menuitem).enabled = false
After creating the instance of the child
private m_Child as form2 'at class level (= field of the class)
'...
m_child = new form2
within the MDI container, use the Addhandler statement to handle the closed event of the child.
addhandler m_child.closed, addressof ChildClosed
In the event handler, enable the menuitem.


....and remove the handler:

private sub ChildClosed( _
ByVal sender As Object, ByVal e As System.EventArgs)

menuitemx.enabled = true
removehandler m_child.closed, addressof ChildClosed
m_child = nothing
end sub
--
Armin

Nov 20 '05 #4

P: n/a
"Armin Zingler" <az*******@freenet.de> wrote in message news:<40***********************@news.freenet.de>.. .
"Kenny" <ge*******@hotmail.com> schrieb
Can you give me some more information cause i don't quite understand.
This handling stuff isn't really my bag.

In the menuitem's click event, set it's enabled property to false (that's
what you probably aready know).


directcast(sender, menuitem).enabled = false
After creating the instance of the child


private m_Child as form2 'at class level (= field of the class)
'...
m_child = new form2
within the MDI container, use the Addhandler statement to handle the

closed
event of the child.


addhandler m_child.closed, addressof ChildClosed
In the event handler, enable the menuitem.


...and remove the handler:

private sub ChildClosed( _
ByVal sender As Object, ByVal e As System.EventArgs)

menuitemx.enabled = true
removehandler m_child.closed, addressof ChildClosed
m_child = nothing
end sub


You are my hero!
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.