Jump to content

GUI Focus


Tomb
 Share

Recommended Posts

Is there any way i can have my main GUI always have focus, so child windows cannot steal focus from it? If my child GUI moves or anything, my main GUI loses focus and i want it to always have focus, or at least always seem to have focus. I really just want the bar above my GUI to always be seen like it was the GUI with focus, that way when the child GUI's move the main GUI seems still on top.

Link to comment
Share on other sites

Would GuiSetState(@SW_DISABLE) help? That means you can't click anything on the GUI so I'm not sure if that's what you need...

i tried but focus is still removed from the main GUI. i am trying to use something with WinActivate, but you still see the main GUI lose focus for a second.
Link to comment
Share on other sites

Is there any way i can have my main GUI always have focus, so child windows cannot steal focus from it? If my child GUI moves or anything, my main GUI loses focus and i want it to always have focus, or at least always seem to have focus. I really just want the bar above my GUI to always be seen like it was the GUI with focus, that way when the child GUI's move the main GUI seems still on top.

well its been several days, and i don't like doing this but i guess i can bump my thread.
Link to comment
Share on other sites

"On top" and "focused" are two different things.

Only one window can have focus at a time. If the user activates and is interacting with a window, it has focus. If it doesn't have focus, the user can't interact with it. Why do you want to go against this fundamental behaviour of operating system, and how do you imagine it working out?

You can switch focus back to whatever window you want whenever you want though, if you're sure it's sensible doing so. For example, catch WM_EXITSIZEMOVE message of some child window(s) and activate the parent window.

Otherwise, post example of what you are trying to do or what you want it to do.

"be smart, drink your wine"

Link to comment
Share on other sites

"On top" and "focused" are two different things.

Only one window can have focus at a time. If the user activates and is interacting with a window, it has focus. If it doesn't have focus, the user can't interact with it. Why do you want to go against this fundamental behaviour of operating system, and how do you imagine it working out?

You can switch focus back to whatever window you want whenever you want though, if you're sure it's sensible doing so. For example, catch WM_EXITSIZEMOVE message of some child window(s) and activate the parent window.

Otherwise, post example of what you are trying to do or what you want it to do.

i think i just want it so that when i
GuiSetState(@SW_SHOW)
a GUI, i want the previous GUI to still have focus. each time it steals focus, and in this case i don't want it to. i want focus to remain on the main GUI until i click on the other one. the other one is a child GUI to the main one.
Link to comment
Share on other sites

Show that GUI using API:

_WinAPI_ShowWindow($hWnd, 4)

or

_WinAPI_SetWindowPos($hWnd, 0, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOREPOSITION, $SWP_NOSIZE, $SWP_NOZORDER, $SWP_SHOWWINDOW))
Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

Show that GUI using API:

_WinAPI_ShowWindow($hWnd, 4)

or

_WinAPI_SetWindowPos($hWnd, 0, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOREPOSITION, $SWP_NOSIZE, $SWP_NOZORDER, $SWP_SHOWWINDOW))
YOU ARE MY HERO!

that has been making me crazy for 2 months. :)

thank you ;)

in all of my time using autoit, i have never used these winAPI functions, but they are very amazing

Edited by Tomb616
Link to comment
Share on other sites

Eh, just tried and noticed that GuiSetState accepts SW_SHOWNOACTIVATE flag too, even if it's not explicitly documented as one of possible flag values for it.

So just GuiSetState(@SW_SHOWNOACTIVATE) will do the trick, no need for WinAPI.au3

Edited by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

Eh, just tried and noticed that GuiSetState accepts SW_SHOWNOACTIVATE flag too, even if it's not explicitly documented as one of possible flag values for it.

So just GuiSetState(@SW_SHOWNOACTIVATE) will do the trick, no need for WinAPI.au3

THAT IS EVEN BETTER! Edited by Tomb
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...