By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Setting focus to an MDI child not working

P: n/a
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 DeveloperExpress
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 DeveloperExpress
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
Share this Question
Share on Google+
2 Replies


P: n/a
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.Focus();

Let me know if this was helpful.

-Prateek
"Mystery Man" <Pr************@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
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 DeveloperExpress
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 DeveloperExpress
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

P: n/a
Thanks Prattek.

I have already done as you suggested but to no avail.
"Prateek" <pr***********@rediffmail.com> wrote in message news:<OT**************@TK2MSFTNGP11.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.Focus();

Let me know if this was helpful.

-Prateek
"Mystery Man" <Pr************@hotmail.com> wrote in message
news:87**************************@posting.google.c om...
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 DeveloperExpress
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 DeveloperExpress
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 discussion thread is closed

Replies have been disabled for this discussion.