Sign in to follow this  
Followers 0
opey

Finding position of my window

16 posts in this topic

I need someway to find the coordinates of the bottom left and right of my window. Because I want to open up a new gui with a click of a button and it will attach itself to the bottom of my window.

Please help.

Thanks

Share this post


Link to post
Share on other sites



Check WinGetPos()

$size=WinGetPos("")

The bottom left coordinates should be $size[0]+$size[2], $size[1]+$size[3]


I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Share this post


Link to post
Share on other sites

Check WinGetPos()

$size=WinGetPos("")

The bottom left coordinates should be $size[0]+$size[2], $size[1]+$size[3]

Only in a mirror. :)

Without the mirror

Bottom left = $size[0], $size[1]+$size[3]

Bottom Right = $size[0]+$size[2], $size[1]+$size[3]


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Is there a way to constantly have this stay "attached" to the main window?

Share this post


Link to post
Share on other sites

in the loop where you do $msg=GuiGetMsg() you can add case

$msg==$GUI_EVENT_DROPPED and then get the new coordinates and move the new window


I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Share this post


Link to post
Share on other sites

ok. thank you. :)

Share this post


Link to post
Share on other sites

I did like this:

Case $msg = $GUI_EVENT_DROPPED
            $nPos = WinGetPos($XSkinGui, "")
            $nPos1 = $nPos[0]
            $nPos2 = $nPos[1] + $nPos[3]
            WinMove($hudGUI, "", $npos1, $npos2)

and its not working...

Share this post


Link to post
Share on other sites

Two things

When you have 2 or more guis GuiGetMsg gets the msg of the current gui (int your case would be the second gui as it is created later). I think you should use GUISwitch(). Also WinGetPos() and WinMove use title as argument and you put handle. You should put title there.

I'm noob and it is possible that I'm writing trash and if so please someone correct me.


I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Still no luck. Which GUI should I switch it to? The main or the one I want to attach?

Edited by opey

Share this post


Link to post
Share on other sites

I've never heard of $GUI_EVENT_DROPPED...

Whats it supposed to do anyway?

Share this post


Link to post
Share on other sites

I've never heard of $GUI_EVENT_DROPPED...

Whats it supposed to do anyway?

It means that when you let go of the gui. As in, you were dragging it and the let go of it. Thats what the event of $GUI_EVENT_DROPPED

Share this post


Link to post
Share on other sites

Well I've been dropping the window for the past 20 minutes and even put a simple msgbox to see if it was going to that case and its not. The msgbox is not appearing

Share this post


Link to post
Share on other sites

Is there something else I can use besides $GUI_EVENT_DROPPED? Like maybe a case $msg that will detect whenever the main window is moved?

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Is there something else I can use besides $GUI_EVENT_DROPPED? Like maybe a case $msg that will detect whenever the main window is moved?

all you need is

Global Const $WM_ENTERSIZEMOVE = 0x231,$WM_EXITSIZEMOVE = 0x232
GUIRegisterMsg($WM_EXITSIZEMOVE,'My_Exit_SIZEMOVE')

..

Func My_Exit_SIZEMOVE()

;code to move your other window here
endfunc
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Thank you, I will try it out.

Share this post


Link to post
Share on other sites

Or you can use,

AdlibEnable ( "_ResetWin", 10)
Func _ResetWin()
$size=WinGetPos("")
$BlCoord = $size[0], $size[1]+$size[3]
$BrCoord = $size[0]+$size[2], $size[1]+$size[3]
WinMove($Gui, "", $BlCoord, $BrCoord)
Endfunc

(Untested, but should work)


My Scripts,[topic="65986"]AI Example[/topic] ,Capable of Emotion!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0