🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.basic.visual.3rdparty
Article #51

Re: MDI menu

#51
From: Daniel Read
Date: Fri, 19 Dec 1997 00:00
45 lines
2633 bytes
>(sorry for my bad English)
>
>In Visual Basic 5 I want make an MDI application with MDIForm and many
>MDIchild forms.
>MDIForm has a large menu (6 or 7 menus in top level). Every MDIChild have
>own
>little menu (1 in top level). When an MDIchild form is activated, then I
>want put the little menu
>to menubar on MDIForm as a submenu under one of top level names. How can I
>do it?
>
>  <snip>
>
>HOW CAN I DO IT?
>

The way to do this is a little strange.  You have to add menus to BOTH
the MDIForm on the MDIChild form.  Some of the menus will be the same
on both forms, but some menu items will only be on either the MDIForm
or the MDIChild.  Only put the minimum menus that you need on the
MDIForm--these would be menu items that can be executed when no
MDIChild forms are open: such as File->Open, File->Exit, Help->About,
etc.

Then put these same exact menus on the MDIChild form.  Then, ONLY on
the MDIChild form, put the rest of your menus--these are menus that
would only make sense when an MDIChild form is open: like File->Close,
Edit-Copy, Edit->Paste, Format-Font, etc.

What you have to remember is that when NO MDIChild form is open, the
menu click events will occur in the MDIForm.  When there is a MDIChild
open, the menu click events will occur in the MDIChild form--NOT the
MDIForm.  So, for the menu items that are on BOTH forms, you have to
code the click events twice: the same exactly in both the MDIForm and
the MDIChild.  The easiest way to do this is to create procedures for
File->Open, File->Exit, Help->About, etc. that both forms' click
events will call--maybe in a BAS module or global class.  This keeps
you from having to keep the same code in two places.

Finally, for the menu items that are only on the MDIChild, you only
have to worry about them in the MDIChild form.

HTH,
Dan Read
Technical Details
Message-ID: <3499f6cc.12429846@news.mindspring.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <34990c0d.0@news.cvut.cz>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108062,8d37b5656588bd74
X-Google-Attributes: gid108062,public
X-Google-Thread: f5f6f,8d37b5656588bd74
X-Google-Attributes: gidf5f6f,public
X-Google-Thread: 110e3b,8d37b5656588bd74
X-Google-Attributes: gid110e3b,public
From: XXdanielread@usa.net (Daniel Read)
Subject: Re: MDI menu
Date: 1997/12/19
Message-ID: <3499f6cc.12429846@news.mindspring.com>
X-Deja-AN: 308479353
Content-Transfer-Encoding: 7bit
References: <34990c0d.0@news.cvut.cz>
X-Server-Date: 19 Dec 1997 04:31:59 GMT
Mime-Version: 1.0
Reply-To: XXdanielread@usa.net
Content-Type: text/plain; charset=us-ascii
Organization: *
Newsgroups: comp.lang.basic.visual.3rdparty,comp.lang.basic.visual.misc,cz.comp.lang.basic.visual