Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable Close Option on MDI Parent, Enable on Child

Status
Not open for further replies.

cnealy

Programmer
Feb 25, 2002
32
0
0
US
I'm trying to make a menu editor that functions similar to the way that MS Office apps do. I have a File/Close menu option in the MDI application, but I can't figure out how to code it.

If the user clicks close (or uses the shortcut) I want to close the MDI child that has focus. I want the close option to be disabled if the MDI parent is the only thing open.

Ideas?
 
Use the Forms collection and check if there are any loaded forms (use the Count property)
 
Write a general routine to do this and call it

1.On Application Startup (if there are any forms, enable the Close menu item)
2.in the Close menu Item (to check if this is the last Form Loaded)

Hope this helps

Engi
 
Sorry to be so dense, but I'm still not clear on what I'm supposed to do.

Can you post some sample code? Also, I'm not clear on what event will trigger this code. Is it in the activate event of the MDI form? Probably not, because it's always active, right? During the application startup, there is always at least one MDI child loaded, so on form load the close button would automatically be enabled.

Some sample code would really help. As you can see, I have no idea what I'm doing. :eek:)

Thanks.
 
Engineer2100 - Are you still out there?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top