PC Review


Reply
Thread Tools Rate Thread

Adapting menu if child is opened

 
 
Kenny
Guest
Posts: n/a
 
      21st May 2004
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.
 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      21st May 2004
"Kenny" <(E-Mail Removed)> 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

 
Reply With Quote
 
Kenny
Guest
Posts: n/a
 
      21st May 2004
"Armin Zingler" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> "Kenny" <(E-Mail Removed)> 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.
 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      21st May 2004
"Kenny" <(E-Mail Removed)> 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

 
Reply With Quote
 
Kenny
Guest
Posts: n/a
 
      24th May 2004
"Armin Zingler" <(E-Mail Removed)> wrote in message news:<40ae23f4$1$24869$(E-Mail Removed)>...
> "Kenny" <(E-Mail Removed)> 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!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adapting Issues Database Opened Date Filter =?Utf-8?B?U3VlIFdoaXRlaGVhZA==?= Microsoft Access Forms 0 18th Feb 2007 03:24 PM
how child form force itself to be opened in new web browser window zhuang Microsoft ASP .NET 2 8th May 2006 08:20 AM
Iterating through all the menu/child items in a menu control Bryan Microsoft ASP .NET 1 1st Mar 2006 09:38 AM
GDS Child Menu ( a child proof shell replacement for windows ? ) *ProteanThread* Freeware 0 18th May 2004 04:19 PM
Adapting folder menu (right click on folder icon) Tom Windows XP Customization 2 14th Nov 2003 10:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:18 PM.