Sign in to follow this  
Followers 0
snowman533

[solved] probably something easy

5 posts in this topic

#1 ·  Posted (edited)

how exactly do i "use" this "mousecoorde mode"?

i mean, how exactly do i show that its even doing anything?

or show any results for that matter

Edited by snowman533

Intermediate AutoIt/Autohotkey User

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

From the help file:

Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:
0 = relative coords to the active window
1 = absolute screen coordinates (default)
2 = relative coords to the client area of the active window

Absolute coordinates are the coordinates where the origin ([0, 0] or [1, 1] I think) is on the upper left corner of the screen.

In relative coordinates, the origin is at the upper left corner of the active window [for option 0] or the client area [for option 2].

That's what I know.

Edited by system24

[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites

snowman533,

Try running this and see if you understand it better:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

GUICtrlCreateLabel("", 100, 100, 2, 2)
GUICtrlSetBkColor(-1, 0xFF0000)

GUISetState()

Opt("MouseCoordMode", 1); Default - screen coords
MsgBox(0, "", "MouseCoordMode 1" & @CRLF & "Relative to screen" & @CRLF & " Mouse will move to top left")

MouseMove(100, 100)

Opt("MouseCoordMode", 0); relative to window
MsgBox(0, "", "MouseCoordMode 1" & @CRLF & "Relative to window" & @CRLF & "Measured from border" & @CRLF & "And so not on pixel")

MouseMove(100, 100)

Opt("MouseCoordMode", 1); Default - screen coords
MsgBox(0, "", "MouseCoordMode 1" & @CRLF & "Relative to screen again" & @CRLF & "Back to top left")

MouseMove(100, 100)

Opt("MouseCoordMode", 2); relative to client area
MsgBox(0, "", "MouseCoordMode 1" & @CRLF & "Relative to client area" & @CRLF & "And so right on the pixel")

MouseMove(100, 100)

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

how exactly do i "use" this "mousecoorde mode"?

i mean, how exactly do i show that its even doing anything?

or show any results for that matter

This shows the different return values of the same position on desktop.

;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

Example1()

; example 1
Func Example1()
    Local $msg, $aPos0, $aPos1, $aPos2

    GUICreate("Test MouseCoordMode") ; will create a dialog box that when displayed is centered
    GUISetState(@SW_SHOW) ; will display an empty dialog box

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client
        $aPos0 = MouseGetPos()

        Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client
        $aPos2 = MouseGetPos()

        Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client
        $aPos1 = MouseGetPos()

        ToolTip('"MouseCoordMode", 0 (relative)  x/y = ' & @TAB & $aPos0[0] & " / " & $aPos0[1] & @CRLF & _
                '"MouseCoordMode", 1 (absolute)  x/y = ' & @TAB & $aPos1[0] & " / " & $aPos1[1] & @CRLF & _
                '"MouseCoordMode", 2 (client)    x/y = ' & @TAB & $aPos2[0] & " / " & $aPos2[1] & @CRLF, $aPos1[0] + 5, $aPos1[1] - 5)

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()
EndFunc   ;==>Example1
;

Share this post


Link to post
Share on other sites

thanks guys, that helped me understand mousecoord and usage of mouse coordinates ^_^


Intermediate AutoIt/Autohotkey User

Share this post


Link to post
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
Sign in to follow this  
Followers 0