Jump to content

displaying child windows centered on parent?


Arrrghmatey
 Share

Recommended Posts

I am writing a program working with dual monitors. When I run the GUI, the main window is on the right side, exactly what I want. But when I create new GUI windows on the fly, they end up on the left side, and same with MsgBoxes. This is not good because the program on the left side is always on top....

I want to make sure that new MsgBoxes and windows always open up centered and on top of the parent gui. Is this possible? If so how do I do it?

Sorry if this is a stupid question... My brain is broken right now ;)

Link to comment
Share on other sites

post an example of what you're doing...

is the monitor you want these to go to the Primary monitor? ( i.e. where the task bar normally resides)

i think MessageBoxes will only go to the primary display.

you might have to move them to the desired location after they're created....

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Link to comment
Share on other sites

Well, I just set the location to like (1800,500) and it works fine for now (I think). However, after some research it looks like you cannot move a msgbox... Very odd. Any suggestions on what to do, besides creating a new GUI window instead of the msgbox? if all else fails I'll just do that, although now I need to figure out how to do a time out.

Link to comment
Share on other sites

I want to make sure that new MsgBoxes and windows always open up centered and on top of the parent gui. Is this possible? If so how do I do it?

what's the output of:

msgbox(0,"", "W: " & @DesktopWidth & " H: " & @DesktopHeight)

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

what's the output of:

msgbox(0,"", "W: " & @DesktopWidth & " H: " & @DesktopHeight)

Cheers

Kurt

<{POST_SNAPBACK}>

1280 x 960. Which is correct for ONE monitor. But I have TWO. The primary monitor is the one that displays the program that is always on top. Since msgboxes always pop up on there, it gets hidden under the program. it has a timeout, so it is very important that the user see it, and they can't when they can't see it!
Link to comment
Share on other sites

1280 x 960. Which is correct for ONE monitor. But I have TWO. The primary monitor is

I guess, that's the problem. msgbox() uses the Win API function MessageBox(). I'm not 100% sure, but I believe a MessageBox is centered on the screen (at least MessageBox has no parameter for the coordinates) . So that's what's happening on your system.

BTW: You cannot move a message box, because your script is paused until the call to msgbox() returns. The only thing you could do is to launch a second script just before the call to msgbox. That second script could then move the msgbox window of it's "father".

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

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...