MDI Parent and MDI child..

MDI Parent and MDI child..

Post by Maheshkuma » Wed, 13 Jul 2005 16:06:09


This is a multi-part message in MIME format.


Hello groups,

I have few questions, please do assist me to solve this queries...

Assuming i'm using VS2005 beta 2, C#


q(1). I have MDI parent and MDI child window. I have placed tools menu in MDI parent which is containing a list of items say imagesharp, imagecontrast etc....if i click imagesharp of MDI parent, i have to sharp the image in MDI child. How i can communicate [ MDI Parent ---- > MDI child ] ??

q(2). Wht are all the ways to access the MDI child member functions from MDI parent class... ??

q(3). Using this.activechild to get the current active child window, but do know how to pass an event or variables from MDI parent to that current active child...???


--
Mh Kum. R

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello groups,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have few questions, please do assist me to solve
this queries...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>
<DIV><FONT face=Arial size=2>Assuming i'm using VS2005 beta 2,
C#</FONT></DIV></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>q(1). I have MDI parent and MDI child window.
I have placed tools menu in MDI parent which is containing a list of items say
imagesharp, imagecontrast etc....if i click  imagesharp of MDI parent, i
have to sharp the image in MDI child. How i can communicate [ MDI Parent ----
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>q(2). Wht are all the ways to access the MDI child
member functions from MDI parent class... ??</FONT></DIV>
<DIV><FONT face=Arial size=2> </FONT></DIV>
<DIV><FONT face=Arial size=2>q(3). Using this.activechild to get the
current active child window, but do know how to pass an event or variables from
MDI parent to that current active child...???</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>-- <BR>Mh Kum. R
<BR></DIV></FONT></BODY></HTML>
 
 
 

MDI Parent and MDI child..

Post by Bob Powell » Wed, 13 Jul 2005 17:50:40

his is a multi-part message in MIME format.


In an MDI application the menu items in the child forms will merge with the menu items of the parent. Generally you should place options that pertain to all windows such as load a file, arrange windows and global application settings in the MDI parent's menu and the operations that pertain to the MDI children such as specific editing features etc, into the menu's of the MDI child classes.

As with all classes, to access them from the outside, a clearly defined interface is required. You can do one of two things to give yourself access to these interfaces. #1 create public properties and methods in the MDI child classes and then cast the reference that you obtain from the active MDI child property of the main form to that class. This will enable you to access individual class types and their properties. The disadvantage in this method will become apparent when you have more than one MDI child type. #2 create an interface implemented by all child types and cast any references to child windows to that interface. You can, for example, create an interface that runs commands using a string to identify the command name. This method is more robust when there are several types of MDI child and means that you can alsways assume that the child will implement the interface no matter what the underlying type of the child class.


--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Maheshkumar.R" < XXXX@XXXXX.COM > wrote in message news:% XXXX@XXXXX.COM ...
Hello groups,

I have few questions, please do assist me to solve this queries...

Assuming i'm using VS2005 beta 2, C#


q(1). I have MDI parent and MDI child window. I have placed tools menu in MDI parent which is containing a list of items say imagesharp, imagecontrast etc....if i click imagesharp of MDI parent, i have to sharp the image in MDI child. How i can communicate [ MDI Parent ---- > MDI child ] ??

q(2). Wht are all the ways to access the MDI child member functions from MDI parent class... ??

q(3). Using this.activechild to get the current active child window, but do know how to pass an event or variables from MDI parent to that current active child...???


--
Mh Kum. R

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>In an MDI application the menu items in the child
forms will merge with the menu items of the parent. Generally you should place
options that pertain to all windows such as load a file, arrange windows and
global application settings in the MDI parent's menu and the operations that
pertain to the MDI children such as specific editing features etc, into the
menu's of the MDI child classes.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV&
 
 
 

MDI Parent and MDI child..

Post by Maheshkuma » Wed, 13 Jul 2005 17:56:52

his is a multi-part message in MIME format.


Thnkz Powell for your brief explanation. Yes i got it, started to go for interface mechanism as you suggested. I mean, I have defined an interface whose implementations are in MDI child. so i can do call those MDIchild easly using this way,

// IMDICbild is the interface name
IMDIChild child = this.ActiveMdiChild as IMDIChild;

This is working fine, THnkz for your reply,
Maheshkumar.R
http://spaces.msn.com/members/cyberiafreak

"Bob Powell [MVP]" < XXXX@XXXXX.COM > wrote in message news: XXXX@XXXXX.COM ...
In an MDI application the menu items in the child forms will merge with the menu items of the parent. Generally you should place options that pertain to all windows such as load a file, arrange windows and global application settings in the MDI parent's menu and the operations that pertain to the MDI children such as specific editing features etc, into the menu's of the MDI child classes.

As with all classes, to access them from the outside, a clearly defined interface is required. You can do one of two things to give yourself access to these interfaces. #1 create public properties and methods in the MDI child classes and then cast the reference that you obtain from the active MDI child property of the main form to that class. This will enable you to access individual class types and their properties. The disadvantage in this method will become apparent when you have more than one MDI child type. #2 create an interface implemented by all child types and cast any references to child windows to that interface. You can, for example, create an interface that runs commands using a string to identify the command name. This method is more robust when there are several types of MDI child and means that you can alsways assume that the child will implement the interface no matter what the underlying type of the child class.


--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Maheshkumar.R" < XXXX@XXXXX.COM > wrote in message news:% XXXX@XXXXX.COM ...
Hello groups,

I have few questions, please do assist me to solve this queries...

Assuming i'm using VS2005 beta 2, C#


q(1). I have MDI parent and MDI child window. I have placed tools menu in MDI parent which is containing a list of items say imagesharp, imagecontrast etc....if i click imagesharp of MDI parent, i have to sharp the image in MDI child. How i can communicate [ MDI Parent ---- > MDI child ] ??

q(2). Wht are all the ways to access the MDI child member functions from MDI parent class... ??

q(3). Using this.activechild to get the current active child window, but do know how to pass an event or variables from MDI parent to that current active child...???


--
Mh Kum. R

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HE