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

MDI Style focus without using MDI forms

Does anyone know of any way to switch focus between a main form and a child form without the usual flickering you get while changing focus between windows?

This works fine if the main form is an MDI container and the child form is within that container, but MDI is not appropriate for this application. I would like to be able to interact with a form without losing focus on the main form.

Obvious workarounds such as setting focus on the main form each time the mouse exits the child form produce a lot of flickering and simply arent acceptable.

Any ideas?

Thanks in advance for any help with this one,

Daniel.
Jan 15 '09 #1
5 3314
Plater
7,872 Expert 4TB
Flickering?
My windows don't flicker when I switch between them?

EDIT:
I would like to be able to interact with a form without losing focus on the main form.
Oh ok, hmm. Have you tried the TopMost setting?
Although I mean by definition, if you are interacting with a window it should have the focus
Jan 15 '09 #2
I mean the general flicker if you actually switch focus between two windows, for example, if you do it fast you get a flicker - perhaps it wasnt the best way to describe it!

Basically if you create a standard MDI app with the main form as an MDI Container and then add a child form, when you actually "select it" i.e. it gets focus you do not loose focus on the main window.

For example, if I were to open a new window from a main window without it being an MDI application I would lose focus on the main window when entering the new one. If i were then to click on the main windows file menu I would have to click twice, once to gain focus, a second time to perform the action I was expecting. Within an MDI situation you do not have to do this.

Is there any way of replicating this behaviour without it being an MDI application?

The main reason I ask is that I need a semi-transparent tool window within an MDI application, if you create a form and set its opacity all's well - but as soon as you set it to be a child form of an MDI parent you loose that opacity because the window layering utilized by Windows to deal with opacity isnt supported on non-top level forms.

As for TopMost, yes I have tried that and it didn't help much.

Thanks for the reply and I hope this clears up my question.
Jan 15 '09 #3
Plater
7,872 Expert 4TB
What OS are you running?
I only have to click once to open up file menus on a non-focused window.

As a thought, what if you made the main window NEVER have focus? I think that's how a lot of programs with floating toolbars do it (like gimp)
Jan 15 '09 #4
Vista at the moment, it does appear to only happen within "my" program and not if I do it between two windows.. odd.

I'll have a look into that one, cheers.
Jan 16 '09 #5
Managed to solve this, if anyone is interested I disabled the "flickering" (read: visual focus change) by overriding WndProc and on WM_NCACTIVATE and WParam == 0 send a message to the window:

SendMessage(this.Handle, WM_NCACTIVATE, 1, IntPtr.Zero);

This re-activates the window, causing it to "appear" in focus every time.
Jan 16 '09 #6

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

Similar topics

3
by: jkstinn | last post by:
I apologize for another post about focus, but whatever I try just doesn't seem to work. I appreciate any ideas that you could give me on getting the focus back to the textbox after tabbing or...
1
by: reneecccwest | last post by:
hello, is there any way to indicte a cursor on the first text user input when a page loads without using onload in the body tag?
2
by: S P Arif Sahari Wibowo | last post by:
Hi! Do you know how to put a form's Access-Visual-Basic-code that will force the form to be inserted, while the user has not type anything in the form, without changing focus, selection, etc.? ...
0
by: Miquel | last post by:
Hi all. I felt frustrated when developing an 'UserControl' derivated from textBox, because sequence event (and Validate event) seems to fail. I Always thought my code was wrong. But after...
1
by: Gil | last post by:
hello, im automating mappoint through access to get mileage between two address fields. when ever i call the function it makes mappoint the focus, and i have to reclick the access screen to regain...
21
by: Sharon | last post by:
I have added an auto scroll feature to my DataGrid control like this: private void DoAutoScroll() { DataView dv = m_DataGrid.DataSource as DataView; DataGridCell cell = m_DataGrid.CurrentCell;...
6
by: rongchaua | last post by:
Hi all, I want to change the style of a button. But I don't know how to do it. For example, I have already a button OK on form. I want to add these styles to this button (WS_CHILD || WS_VISIBLE ||...
4
by: Jon Slaughter | last post by:
I've created some custom controls and forms that allow the feature to temporarily transfer focus to a control that has been entered by the mouse. Everything seems to work fine but the problem I...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.