473,657 Members | 2,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting focus to an MDI child not working

We have an MDI application that is not setting always setting focus to
the newly corrected MDI. It is creating the form and it is the topmost
but it does not have focus.

The code we are using to activate the MDI is something like the
following:

frmTest frm = new frmTest();
frm.MdiParent = this;
frm.Show();

I have tried calling frm.Activate() and Focus() but to no avail.
Creating a non-MDI works OK.
We are launching the MDI by double clicking on a DeveloperExpres s
grid. However, if we use a context menu on the grid and go through
exactly the same handler code to open the form, then this works fine.

Therefore, I am not sure if it is a .NET problem, a DeveloperExpres s
problem or what? I notice that in the newsgroup some other people were
having similar problems with focus on MDI child forms.
Nov 15 '05 #1
2 7401
Hi,

Seems like a DevExp problem because this does work fine in a normal
MDIParent-Child scenario.

However, make sure you are calling the Focus method of the Child Form after
its Show() method.

Another thing you may want to try is to set Focus to a control in the child
form. Suppose, the child form contains a textbox named TextBox1, then set
the following line after the call to the Show() method.
f.TextBox1.Focu s();

Let me know if this was helpful.

-Prateek
"Mystery Man" <Pr************ @hotmail.com> wrote in message
news:87******** *************** ***@posting.goo gle.com...
We have an MDI application that is not setting always setting focus to
the newly corrected MDI. It is creating the form and it is the topmost
but it does not have focus.

The code we are using to activate the MDI is something like the
following:

frmTest frm = new frmTest();
frm.MdiParent = this;
frm.Show();

I have tried calling frm.Activate() and Focus() but to no avail.
Creating a non-MDI works OK.
We are launching the MDI by double clicking on a DeveloperExpres s
grid. However, if we use a context menu on the grid and go through
exactly the same handler code to open the form, then this works fine.

Therefore, I am not sure if it is a .NET problem, a DeveloperExpres s
problem or what? I notice that in the newsgroup some other people were
having similar problems with focus on MDI child forms.
Nov 15 '05 #2
Thanks Prattek.

I have already done as you suggested but to no avail.
"Prateek" <pr***********@ rediffmail.com> wrote in message news:<OT******* *******@TK2MSFT NGP11.phx.gbl>. ..
Hi,

Seems like a DevExp problem because this does work fine in a normal
MDIParent-Child scenario.

However, make sure you are calling the Focus method of the Child Form after
its Show() method.

Another thing you may want to try is to set Focus to a control in the child
form. Suppose, the child form contains a textbox named TextBox1, then set
the following line after the call to the Show() method.
f.TextBox1.Focu s();

Let me know if this was helpful.

-Prateek
"Mystery Man" <Pr************ @hotmail.com> wrote in message
news:87******** *************** ***@posting.goo gle.com...
We have an MDI application that is not setting always setting focus to
the newly corrected MDI. It is creating the form and it is the topmost
but it does not have focus.

The code we are using to activate the MDI is something like the
following:

frmTest frm = new frmTest();
frm.MdiParent = this;
frm.Show();

I have tried calling frm.Activate() and Focus() but to no avail.
Creating a non-MDI works OK.
We are launching the MDI by double clicking on a DeveloperExpres s
grid. However, if we use a context menu on the grid and go through
exactly the same handler code to open the form, then this works fine.

Therefore, I am not sure if it is a .NET problem, a DeveloperExpres s
problem or what? I notice that in the newsgroup some other people were
having similar problems with focus on MDI child forms.

Nov 15 '05 #3

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

Similar topics

9
48925
by: Randell D. | last post by:
Folks, I'm working on a contact name/address database whereby a slimed down list is shown in the main window. When a record is selected, the complete record is displayed in a new window via a call to window.open As opposed to closing and re-opening new windows, I would prefer that when the user is finished reading the complete record, they can click a link whereby the main window is sent in to focus.
20
12296
by: Arne | last post by:
During testing <div style="overflow:auto;"> in CSS I noticed the mousewheel would work in Mozilla only after I made a <a href="#">some text</a> link and clicked on that, within the div. It appears as if Mozilla needs to have the focus set on that div in order for the mousewheel to work. That's all that link does. The mousewheel works perfectly in IE without the link. It scrolls the div even if there is a scrollbar on the page. Is...
1
3365
by: tdmailbox | last post by:
Is there a vb command that can tell me if I have focus in the child or parent form? Basicly I have a search macro that needs me to have focus to any field in the parent form. If my focus is set on any field in the parent form it will search that field. However if I have focus set to a field in the child form it fails. What I want to do is set focus to field1 of the parent table but ONLY if focus is on a field in the child form. Is...
2
1904
by: Sridhar | last post by:
Hi, I have a question. I have created a user control which contains a textbox and a button. we will enter some search word in the textbox and hit the button. Then we will get a pop-up with the listbox that contains the matches. Once I select one of the matches, it will close the pop-up and display the selected one in a label control which is also in the user control. Everything is working fine. But I am not getting one thing. After the...
9
2809
by: Dick | last post by:
How do I set the focus to a control that is a child to a FormView? I've tried the obvious (below) and lots of variations but none seam to work! Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.FormView1.Row.FindControl("TextBox1").Focus() End Sub
1
2047
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
1
5133
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
5
2035
by: Finn Stampe Mikkelsen | last post by:
Hi How can i set a focus to a textbox in my codebehind page?? I have this WebForm, that takes information from a user and 2 buttons on the form. One that takes action on the entered information and one that resets the form... The second on, the reset button, i would like to set focus back to the first textbox on the form. I already have an onload in my body, which sets the
4
2214
by: Spizzat2 | last post by:
I'm trying to figure out a workaround to a minor annoyance that I'm coming up with while coding a site. I've got some keyboard shortcuts set up for the site via javascript, and when I press escape, it's set to hide several divs on the page, and remove focus from a link. Unfortunately, I don't know which link will have focus, so I can't just blur a particular element (that I'm aware of) since I won't know which element it is. I got it...
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.