Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#2913 closed Bug (Rejected)

Mouse cursor jumps when showing a GUI with child

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: 3.3.12.0 Severity: None
Keywords: Cc:

Description

If you have set the windows mouse properties to automatically move the mouse to the default button (http://3.bp.blogspot.com/_D0ACeJescMU/TKrs3MduTMI/AAAAAAAAAfo/oAn2ccCo_EI/s1600/snap_to_5.png), the following constellation of GUIs will cause the cursor to jump.
Tested on Windows 8 x64.

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

$hGUI = GUICreate("Watch your mouse cursor")
GUISetState(@SW_SHOW, $hGUI)

$hParent = GUICreate("")
$hChild = GUICreate("", 50, 50, -1, -1, $WS_CHILD, -1, $hParent)
Sleep(2000)
GUISetState(@SW_SHOW, $hParent)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

The GUI with the $WS_CHILD style is causing this problem, although the mouse also won't jump if there was no other GUI visible before $hParent.

Attachments (0)

Change History (3)

comment:1 Changed 10 years ago by Synix <cross.fire@…>

Okay my example code was not ideal.
This code also shows that the mouse will jump to the center of the child GUI:

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

GUICreate("Watch your mouse cursor")
GUISetState(@SW_SHOW)

$hParent = GUICreate("")
$hChild = GUICreate("", 50, 50, 0, 0, $WS_CHILD, -1, $hParent)
GUISetBkColor(0x0, $hChild)
GUISetState(@SW_SHOW, $hChild)
Sleep(2000)
GUISetState(@SW_SHOW, $hParent)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

comment:2 Changed 10 years ago by Jpm

  • Resolution set to Rejected
  • Status changed from new to closed

I don't think AutoIt GUI Windows are dialog Windows box.
So this mouse behavior does nothing just try a button on the parent Windows and start it alone.
You will see the mouse is not moving to the button.
So why the mouse is moving to the child Windows is certainly a side effect

I close it as the moving cannot be handled by a main GUI due to AutoIt implementation

comment:3 Changed 10 years ago by Synix <cross.fire@…>

But how do I prevent the cursor from jumping to this child window? This is not expected and should certainly not happen. Jumping to $BS_DEFPUSHBUTTON buttons does work as expected (only not on the first GUI ever showing up), except inside this child window from my example.
Try this:

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

GUICreate("Watch your mouse cursor")
GUICtrlCreateButton("Doesn't work on the first GUI ever showing up", 70, 20, 300, 20, $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)
Sleep(2000)

GUICreate("Watch your mouse cursor")
GUICtrlCreateButton("Doesn't work on the first GUI ever showing up", 70, 20, 300, 20, $BS_DEFPUSHBUTTON)
GUISetState(@SW_SHOW)

$hParent = GUICreate("")
GUICtrlCreateButton("", 70, 20, 100, 20, $BS_DEFPUSHBUTTON)
$hChild = GUICreate("", 50, 50, 0, 0, $WS_CHILD, -1, $hParent)
GUISetBkColor(0x0, $hChild)
GUISetState(@SW_SHOW, $hChild)
Sleep(2000)
GUISetState(@SW_SHOW, $hParent)

$hParent = GUICreate("")
$hChild = GUICreate("", 170, 40, 0, 0, $WS_CHILD, -1, $hParent)
GUICtrlCreateButton("", 70, 20, 100, 20, $BS_DEFPUSHBUTTON)
GUISetBkColor(0x0, $hChild)
GUISetState(@SW_SHOW, $hChild)
Sleep(2000)
GUISetState(@SW_SHOW, $hParent)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

A workaround would be nice at least :)

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.