473,587 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MDI childs - can't make active no matter what i try

5 New Member
Hello everyone,

I have a C# winforms application which is designed as a mdi application.
I am having a focus problem with it that I cannot seem to solve.

If I open a mdi child and it is the only child form that is open in the mdi parent then the focus sets to this mdi child without issue and the cursor appears in the text field with the tab index of 0 exactly as it should.

However, if I open up a mdi child form and another mdi child form is already open in the mdi parent, then the mdi chid becomes active (the title bar is bright blue as if it is active) but the cursor stays on the first mdi child window. So if I hit the tab key even though the back window does not have focus, the controls in the back window are being tabbed through rather than the front window with focus.

I thought that it might relate to how I was displaying the mdi child so I have tried all of these options include many variations of sequence
frmPOS.TopMost = true;
frmPOS.Show();
frmPOS.Activate ();
frmPOS.Focus();
frmPOS.BringToF ront();
frmPOS.Refresh( );
frmPOS.Select() ;
frmPOS.Update() ;

No matter what I do, the cursor will not appear in the mdi child that i display if at least 1 mdi child is already on the screen.

Any ideas?
Nov 16 '06 #1
1 2991
ferguslogic
5 New Member
Well I answered my own question and I hope that this helps someon else out.

I bet this is causing 99% of the mdi child focus problems that everyone is experiencing when you search on google, msdn or here on these boards.

The problem with my mdi child focus issue was being caused by the way i was firing and handling events or by the way .net handles this functionality.

In my application, a modal dialog was being displayed so that users could type in employee numbers before opening a mdi child screen (for security purposes).

This box was firing events of loginSucceeded and loginFailed and the event handlers would then close the modal login screen and show the correct mdi child form.

You would think this would work but when stepping through the code i noticed that irregardless as to whether I closed the modal form or not, .net was still returning focus back to it to finish out the sub procedure after the event fired and this was pulling focus away from my mdi child forms.


So i removed the event functionality and used the DialogResult returned from the modal dialog instead which ensured that this window was closed prior to showing the mdi child and that resolved the issue.

If you are having mdi child focus issues, step through the code with f10 and see if focus is being set somewhere else after your mdichild is displayeyed.

8 )

hope that helps someone.
Nov 16 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
27271
by: Lin Ma | last post by:
I first post this to win2000.active_directory group and I find out it may be a wrong group. I hope this group can help me. Hello, In ASP page, does any one knows how to get user network login ID from user email address?
3
570
by: -H | last post by:
Hi, I have a "parent" C program that forks off a "child" C program. Both the parent and the child print information to both stdout and stderr. I would like to redirect the parent and childs output to both stdout and an output logfile (in effect, a "tee" like behavior). I've tried several things with pipes and freopens, but I always seem
2
1861
by: Sergio del Amo Caballero | last post by:
Hi, I have a structer like this: <div class="node"> <a><img /></a> <div class="child"> <a><img /></a> </div> <div class="child"> <a><img /></a>
4
4497
by: Stephen Poley | last post by:
The issue of the focus pseudo-class came up a few weeks ago, and I finally got around to trying it out (better late than never ...) The recommended order given for the pseudo-classes is link, visited, focus, hover, active. However: - Mozilla doesn't seem to do anything with the active rule; - IE gets things wrong as usual: it uses the...
13
4966
by: Krzysztof Bartosiewicz | last post by:
Hi! I have a problem with an access database. The database which I designed and made using MS access works perfectly OK on my computer however it is not working at all on computers for which it was done :) When the client tries to open first form the access shows information about error connected to the communication between Access and OLE...
2
2144
by: Bob Hollness | last post by:
Hi group. Merry Xmas one and all!!!! I hope Santa brings you all something good. For me, I would be happy with some nice code! If I check a node in a treeview, how do I check all childs of that node? I wrote: Dim Child As TreeNode = Nothing For Each Child In myTreeView.Nodes
0
3330
by: B111Gates | last post by:
OK I know this is a complex question so I will break it up. I know that SSPI is the prefered method of authentication, however if I use the sample provide by MS I cannot authenticate across domains. Sample Here http://support.microsoft.com/d­efault.aspx?scid=kb;en-us;2798­15 Article ID : 279815
1
1268
by: Stampede | last post by:
Hello, I created a Windows Application Project and tried to create a MDI-based application. So I created a new MDI-parent with the creation wizzard. Then I created a default form and tried to make it a MDI-child of the parent I just created, but I didn't find an entry in the properties dialog which would the form make a MDI-child. Can...
4
2131
osward
by: osward | last post by:
I had made a table colum sortable and paging the table, following are the code // Display Event List echo "<center>"._EVENTLIST."</center><br>"; $now = Date(Y-m-d); // sort table colum if(!isset($_GET)){ $page = 1; } else {
0
7915
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...
1
7967
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...
1
5712
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
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...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
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
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.