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.
5 3344 Plater 7,872
Recognized Expert Expert
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
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.
Plater 7,872
Recognized Expert Expert
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)
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.
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(thi s.Handle, WM_NCACTIVATE, 1, IntPtr.Zero);
This re-activates the window, causing it to "appear" in focus every time.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 clicking out.
Jason
function checkTime(timeVal) {
var hr, mn;
if (timeVal.length != 4)
{
alert("Time entered must be 4 characters: ex. 0130.");
|
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?
|
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.?
Here is the story.
I have this structure:
|
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 trying the UserControl a
lot of hours I have the feeling that c# (or .Net) fails.
Thus, I have developed a simple program with 3 textBox, 1 Botton and 1
ListBox (for showing results) which fire OnEnter, OnGotFocus,
|
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 access forms
focus. how can i get access focus via vba and without having to click
the form?
i tried using docmd.selectobject acform, "myform" and me.setfocus . it
looks like it works by highlighting a text box however the mappoint is
still...
| |
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;
cell.RowNumber = dv.Count;
m_DataGrid.CurrentCell = cell;
}
But this the last line of this code is putting the focus on the current
|
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 || WS_CLIPSIBLINGS || WS_TABSTOP ||
BS_FLAT).
What should I do now?
All help will be appreciated.
rca.
|
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 have is that sometimes I
seem to loose the original "holder" of focus and when the user hits tab
while using "temporary" focus(while the mouse is over a control) it will
change focus to the next control but not update it.
So I have several issues....
|
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 on.
It's a simple program that loads a control onto a form and binds "Foo"
against a combobox ("SelectedItem") for it's "Bar" property and a
datetimepicker ("Value") for it's "DateTime" property. The
DateTimePicker.Visible value is set to...
|
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...
|
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...
| |
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,...
|
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...
|
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...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |