473,397 Members | 1,985 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,397 software developers and data experts.

MDI Children

Yesterday, I posted a question about accessing controls on a child form. I had trouble understanding it. I am NOT rewriting this program, and need a way to work this out the way it is. Here is exactly what I'm dealing with: I have my main form(Form1), which contains a third-party main-menu and two third-party toolbars. Then there is its child form(frmTextControl) which contains a third-party text control set to fill docking. That is the only control on that form. When I have multiple instances of the child form(frmTextControl), I want to beable to assign the font of the active textcontrol ONLY. This would require access to the active MDI child form. I need to know how to name each intance of the child form, and to be able to have access to the active instance of the child form. And again, I don't want any alternate methods of accomplishing this, but how to do it with the setup I currently have. Thank You!
Nov 16 '05 #1
4 1317
I noticed while in Form1, I could do "Form1.ActiveMdiChild" but it did not contain the control that I wanted. Is it possible to have the control listed within "Form1.ActiveMdiChild. Note: The textcontrol's modifier is set to public

----- I wrote: ----

Yesterday, I posted a question about accessing controls on a child form. I had trouble understanding it. I am NOT rewriting this program, and need a way to work this out the way it is. Here is exactly what I'm dealing with: I have my main form(Form1), which contains a third-party main-menu and two third-party toolbars. Then there is its child form(frmTextControl) which contains a third-party text control set to fill docking. That is the only control on that form. When I have multiple instances of the child form(frmTextControl), I want to beable to assign the font of the active textcontrol ONLY. This would require access to the active MDI child form. I need to know how to name each intance of the child form, and to be able to have access to the active instance of the child form. And again, I don't want any alternate methods of accomplishing this, but how to do it with the setup I currently have. Thank You!
Nov 16 '05 #2
You can cast the ActiveMdiChild property. Let's assume you child forms are
*always* of type frmTextControl.

((frmTextControl)Form1.ActiveMdiChild).MySuperDoop erDockingControl

"Bill English" <an*******@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.com...
I noticed while in Form1, I could do "Form1.ActiveMdiChild" but it did not contain the control that I wanted. Is it possible to have the control
listed within "Form1.ActiveMdiChild. Note: The textcontrol's modifier is
set to public.
----- I wrote: -----

Yesterday, I posted a question about accessing controls on a

child form. I had trouble understanding it. I am NOT rewriting this
program, and need a way to work this out the way it is. Here is exactly
what I'm dealing with: I have my main form(Form1), which contains a
third-party main-menu and two third-party toolbars. Then there is its child
form(frmTextControl) which contains a third-party text control set to fill
docking. That is the only control on that form. When I have multiple
instances of the child form(frmTextControl), I want to beable to assign the
font of the active textcontrol ONLY. This would require access to the
active MDI child form. I need to know how to name each intance of the child
form, and to be able to have access to the active instance of the child
form. And again, I don't want any alternate methods of accomplishing this,
but how to do it with the setup I currently have. Thank You!
Nov 16 '05 #3
Ok, here's an example. Let's say you have a button on Form1 called myButton
with an event handler called myButton_Click.

private void myButton_Click(object sender, EventArgs e)
{
TextControl tc = ((frmTextControl)this.ActiveMdiChild).myTextContro l;
//This will be the name of the control that you have the public access
modifier on.
//Now do whatever you want with tc.
}
"Bill English" <nu****@comcast.net> wrote in message
news:88**********************************@microsof t.com...
// You can cast the ActiveMdiChild property. Let's assume you child forms are // *always* of type frmTextControl.
//
// ((frmTextControl)Form1.ActiveMdiChild).MySuperDoop erDockingControl
//

My child form is always frmTextControl. I tried putting your code into

mine, but I don't know how to implement it. Could you tell me what form to
place it in, and in what context? Thank You Very Much!
Nov 16 '05 #4
You can also use the "as" operator to do the cast. It doesn't raise an
exception on failure, instead it returns null.
private void myButton_Click(object sender, EventArgs e)
{
frmTextControl tc = this.ActiveMdiChild as frmTextControl;

//Again you can Now do whatever you want with tc.

if( tc != null )
{
tc.myFunc();
}
}
Nov 16 '05 #5

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

Similar topics

1
by: Todd Cary | last post by:
In my previous post, I stated that some JavaScript I inherited does not work in Firefox but does work in IE 6 . I have now isolated a line where it fails in Firefox; the line with the property of...
6
by: Luke Dalessandro | last post by:
I'm not sure if this is the correct forum for platform specific (Mozilla/Firefox) javascript problems, so just shout and point me to the correct newsgroup if I'm being bad. Here's the deal... ...
17
by: eric.nave | last post by:
What is the correct way to find all the form elements in a particular div? I'd like to be able to loop through them and disable them. For example: <form> <div id="div1"> <input type=text...
0
by: Walt Borders | last post by:
Hi, My problem: Merging two datasets deletes parent elements, preserves all children. I've created two dataSets. Each use the same schema, parent-child nested tables. The first dataSet is...
1
by: Marius Groenendijk | last post by:
Dear Group, I have a MDI with children which may be editing data. If a MDI child closes its Closing handler asks a question 'exit w/out saving?'. On closing the MDI its pops a question 'Exit...
2
by: Pucca | last post by:
I'm building a treeview and a list view. I need to know when I reached the end of the tree nodes, which means that node or directory entry has no children. Is there a property or method in...
7
by: Thierry Lam | last post by:
I have the follownig codes: <html> <head> <title>Simple doc</title> </head> <body> <script type="text/javascript"> function greet() {
3
by: Andrej Pavlovic | last post by:
Hi, Please look at the following HTML snippet: <body> some text <p>more text</p> even more text </body>
10
by: qwertycat | last post by:
I'm new to multi-process programming, should one avoid forking children from children of a parent? I'd like to spawn 10 children from the parent and each of those children spawns another 5...
9
MrPickle
by: MrPickle | last post by:
I have a structure like so: struct node { float x, y, z; std::vector<node> children; }; and I want to loop through all the node's children, then all the children's children then all the...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.