473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Can child forms listen for events on the parents mainmenu?

I know I can merge a child forms menu into the MDI parent's mainmenu, but I
would also like to listen for common events fired from the mainmenu that
might be of interest to any child forms.

Is this possible?
Nov 15 '05 #1
4 2484
Sean,

In order to do this, you will have to do some coding yourself.
Basically, you will have to register "listeners" with the parent form which
will be called when the menu items are clicked. When this happens, the
parent form will have to cycle through the listeners, seeing which one
handles the menu item that was clicked.

How you do this is up to you, as there are a number of ways that this
could be designed, but the overall concept is that the child forms would
register with the parent through some general mechanism indicating when a
menu item is clicked.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sean Connery" <nf*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
I know I can merge a child forms menu into the MDI parent's mainmenu, but I would also like to listen for common events fired from the mainmenu that
might be of interest to any child forms.

Is this possible?

Nov 15 '05 #2
I was afraid it wasn't going to be simple. Do you know of any code samples
where this is done?

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ut**************@TK2MSFTNGP09.phx.gbl...
Sean,

In order to do this, you will have to do some coding yourself.
Basically, you will have to register "listeners" with the parent form which will be called when the menu items are clicked. When this happens, the
parent form will have to cycle through the listeners, seeing which one
handles the menu item that was clicked.

How you do this is up to you, as there are a number of ways that this
could be designed, but the overall concept is that the child forms would
register with the parent through some general mechanism indicating when a
menu item is clicked.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

Nov 15 '05 #3
Sean,

I don't know of any offhand. There might be something at
codeproject.com. You want to find something that implements a Command
pattern, as this is really what you are trying to do (a Command
infrastructure actually gives you a little more, but at its core, it's what
you want).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sean Connery" <nf*@nospam.com> wrote in message
news:On**************@TK2MSFTNGP12.phx.gbl...
I was afraid it wasn't going to be simple. Do you know of any code samples
where this is done?

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:ut**************@TK2MSFTNGP09.phx.gbl...
Sean,

In order to do this, you will have to do some coding yourself.
Basically, you will have to register "listeners" with the parent form

which
will be called when the menu items are clicked. When this happens, the
parent form will have to cycle through the listeners, seeing which one
handles the menu item that was clicked.

How you do this is up to you, as there are a number of ways that this could be designed, but the overall concept is that the child forms would
register with the parent through some general mechanism indicating when a menu item is clicked.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com


Nov 15 '05 #4
Hi,

I have MDI Child and MDI Parent Window. Now I have FILE and EDIT menu
in Parent as well as Child window. When my Child window is launched,
the FILE menu of child should get merged to FILE menu of Parent and
EDIT menu of Child should get merged to EDIT menu of Parent. Can you
tell me how to do this? Also can you tell me how to trigger the click
events of CHILD MENU.

Thanks in advance.

Regards,
Sunil
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: red | last post by:
mouse events when the mouse is on a "child control" hi everyone; my problem: I have a userControl in this usercontrol, I have a child control (a button) when the mouse moves over the...
13
by: Stuart McGraw | last post by:
I haven't been able to figure this out and would appreciate some help... I have two tables, both with autonumber primary keys, and linked in a conventional master-child relationship. I've...
6
by: Tom | last post by:
Rather than merge child menus, I would like for some common functionality between various MDI child forms to process an event fired from the main menu, depending on who is in focus. Is this...
3
by: James Spibey | last post by:
Hi, I have an MDI application which has aboout 10 child windows. The way the app needs to work is that only one window should be visible at a time and it should be maximized within the parent...
3
by: Maheshkumar.R | last post by:
Hi groups, How i can command over the MDI CHIlD forms created dynamically at runtime from PARENT. Let say, i have generated 5 mdichild forms, but i want to work with child form1 from MDI...
3
by: Lance | last post by:
I've noticed that controls that are contained in MDI child forms fail to raise MouseLeave events if the MDI child form's MdiParent property is set to Nothing (after it was set to an existing MDI...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
4
by: Steve Barnett | last post by:
I've created a simple MDI application and have designated the Window menu to keep track of the mdi children. When I first load an mdi child, it's caption consists of "File: no file loaded" and this...
13
by: Academic | last post by:
I have a MDI form, sometimes child forms and sometimes forms that are neither If I close the app the child forms closing and closed event happens followed by the Mdi form receiving the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.