Board index » cppbuilder » MDI WindowMenu Property

MDI WindowMenu Property

I have set the WindowMenu Property to my menu on my parent form, but none of
my child forms show up in the window list.  I create an entirely basic new
MDI project which only creates new mdichild forms they show up, but not in
my project that I am working on which is a main form with a menu, status
bar, and tool bar.  The child forms have a menu, richedit control and
several dialogs.  Any ideas?

    Roger

 

Re:MDI WindowMenu Property


Quote
"R.H." wrote:

> I have set the WindowMenu Property to my menu on my parent form, but none of
> my child forms show up in the window list.

my menu ?

Does that TMenuItem have atleast one TMenuItem at designtime ?

Hans.

Re:MDI WindowMenu Property


Yes it does.  My menu consists of a File, Windows, and About menus with
multiple members.  My Windows menu consists of Cascade, Arrange Icons, and
Tile which do work at this time.

    Roger

Quote
"Hans Galema" <j.m.gal...@maartens.nl> wrote in message

news:3C2EF464.3859B28E@maartens.nl...
Quote
> "R.H." wrote:

> > I have set the WindowMenu Property to my menu on my parent form, but
none of
> > my child forms show up in the window list.

> my menu ?

> Does that TMenuItem have atleast one TMenuItem at designtime ?

> Hans.

Re:MDI WindowMenu Property


Quote
"R.H." wrote:
> My Windows menu consists of Cascade, Arrange Icons, and
> Tile which do work at this time.

Then i don't know how to help you.

You could start with a new MDI application with two children
and only a simple mainmenu and see if it works the,
A matter of minutes.

Good luck.

Hans.

Re:MDI WindowMenu Property


Okay, thanks anyway.  I suspose I am going to have redo my project from
scratch just to get the window lists.

    Roger

Quote
"Hans Galema" <j.m.gal...@maartens.nl> wrote in message

news:3C2F8E5D.4C14399F@maartens.nl...
Quote
> "R.H." wrote:

> > My Windows menu consists of Cascade, Arrange Icons, and
> > Tile which do work at this time.

> Then i don't know how to help you.

> You could start with a new MDI application with two children
> and only a simple mainmenu and see if it works the,
> A matter of minutes.

> Good luck.

> Hans.

Re:MDI WindowMenu Property


The Children windows are not supposed to automatically appear in the Windows
menu, you have to do that yourself manually.  In my MDI project, I do this
by creating a TMenuItem in the MDI child form's constructor, an add it to
the main form's Window menu.  When the child is closed, I remove and free
the menu item.

In other words:

    #include "Unit1.h"

    class TChildForm : public TForm
    {
    private: // User declarations
        TMenuItem *ViewItem;
        void __fastcall ViewClicked(TObject *Sender);
    };

    __fastcall TChildForm::TChildForm(AnsiString Path)
        : TForm(MainForm)
    {
        // View1 is the TMenuItem which active child forms are listed under

        ViewItem = new TMenuItem(MainForm->View1);
        ViewItem->Caption = Path;
        ViewItem->OnClick = ViewClicked;
        MainForm->View1->Add(ViewItem);
    }

    void __fastcall TChildForm::FormClose(TObject *Sender, TCloseAction
&Action)
    {
        MainForm->View1->Remove(ViewItem);
        delete ViewItem;

        Action = caFree;
    }

    void __fastcall TChildForm::ViewClicked(TObject *Sender)
    {
        BringToFront();
    }

Gambit

Quote
"R.H." <roger...@mindspring.com> wrote in message news:3c2f9c62_2@dnews...
> Okay, thanks anyway.  I suspose I am going to have redo my project from
> scratch just to get the window lists.

Re:MDI WindowMenu Property


Quote
Remy Lebeau wrote:

> The Children windows are not supposed to automatically appear in the Windows
> menu, you have to do that yourself manually.  

What is 'are not supposed to' ?
If I just set WindowMenu to a TMenuItem it works.

Hans.

Re:MDI WindowMenu Property


snip: "If I just set WindowMenu to a TMenuItem it works."

I used to be able to get the child list to automatically appear in the
appropriate 'WindowMenu' of the MDI form, and did so on many occasions.

Lately I have not been able to get it to do it.

The only reason that I have come up with is that SP1 screwed this up - does
this sound likely?

BTW I'm using BCB5 Pro.

--
Van Tumour
----------------------------------
v...@vantumour.com
http://www.vantumour.com
----------------------------------

Re:MDI WindowMenu Property


Quote
> I used to be able to get the child list to automatically appear in the
> appropriate 'WindowMenu' of the MDI form, and did so on many occasions.
<snip>
> The only reason that I have come up with is that SP1 screwed this up -
does
> this sound likely?

> BTW I'm using BCB5 Pro.

    Well. I have a project with MDI forms... I just had to set the
MainForm's (FormStyle = sfMDIForm) WindowMenu property to Window1. Window1
is the name of the TMenuItem that represents the "Window" entry in my
menubar... No problems at all.

    I'm using BCB 5.0 Pro with SP1... So, I'm afraid that's not the reason
of your problems...

    Here's a snip from my project's DFM file :

object Form1: TForm1
    <snip>
  FormStyle = fsMDIForm
  KeyPreview = True
  Menu = MainMenu1
  OldCreateOrder = False
  ShowHint = True
  WindowState = wsMaximized
  WindowMenu = Ventana1            <-------- Here's my WindowMenu assignment
<snip>

  object MainMenu1: TMainMenu
    Images = ImageList1
    Left = 336
    Top = 48
    <snip>
    object Ventana1: TMenuItem                    <----------- This is the
Menu item I use as "WindowMenu"....
      Caption = '&Ventana'
      object Cascada1: TMenuItem
        Action = caWindowCascade
      end
      object MosaicoHorizontal1: TMenuItem
        Action = caWindowTileHorizontal
      end
      object MosaicoVertical1: TMenuItem
        Action = caWindowTileVertical
      end
      object Organizar1: TMenuItem
        Action = caWindowArrange
      end
    end
    <snip>

HTH

--
Gonzalo N?ez Riboni
Puebla, Puebla
MXICO

Re:MDI WindowMenu Property


Well, that was the way I would expect it to work.

I did a simple test to check this stuff out.

I created a Form and set the FormStyle fsMDIChild.
I created another Form and set the FormStyle to fsMDIForm.
I created a MainMenu on the MDI Parent Form and in it's Menu Designer I did
'Insert from Template', and chose 'MDI Frame Menu'.
I set the MDI Parent Form's 'WindowMenu' to 'Window1' (a TMenuItem).

When ran, everything worked as expected, except that the child form was not
listed anywhere in the menu.

I tried again, and set the MDI Parent's 'WindowMenu' to 'Help1' (another
TMenuItem), and this time it worked!
(The MDI child appeared at the bottom of the Help menu).

'Help1' is the only TMenuItem that works in this example.

Can anyone reproduce this rubbish behaviour?

Cheers

--
Van Tumour
----------------------------------
v...@vantumour.com
http://www.vantumour.com
----------------------------------

Re:MDI WindowMenu Property


I started my project over and now I can get the window list to show, but it
seems to be very erratic.  When I first start my application and look in the
window list there is no list of the initial child form that comes up.  But
if I go and create a new child and then look at the list, both child forms
are there.  If I restart the application and click on new twice and look at
the list there is nothing there , but if I click new again and then look at
the list, all three are there.  It seems that I need to look at the list
first before anything will show up.  Is there a way to force the list to be
populated by the child forms whether I look at the list or not?

    Roger

Other Threads