Jump to content
Sign in to follow this  
MouseSpotter

UDF Register Event - Mouse & Keyboard

Recommended Posts

MouseSpotter

RegisterEvent.au3

This module captures Mouse and Keyboard events by registering events that an object responds to; and the function to call for that event

Documentation:

Usage
-----
_RegEvent_RegForm to register a form for events
_RegEvent_RegCtrl to register a control for events
Func <name> to catch an event registered to that <name>
Register Events
---------------
The events that can be registered are shown below
     Drag events
         dragStart
         dragMove
         dragEnd
     Focus events
         focusGot
         focusLost
     Key events
         keyDown
         keyUp
     Mouse events
         MouseClick
         MouseDown
         MouseEnter
         MouseLeave
         MouseMove
         MouseUp
Registering events
-------------------
     To register a form use the _RegEvent_RegForm($formHandle,$eventName,$function,$tag="") function
     Parameters
         $formHandle
         | The handle of the form being registered
         $eventName
         | The event name to be registered for. Must be one of the above event names
         $function
         | The function name to be called when the event occurs
         $tag
         | A tag to associated to the object event
     To register a control use the _RegEvent_RegCtrl($formHandle,$ctrlID,$eventName,$function,$tag="") function
     Parameters
         $formHandle
         | The handle of the form being registered
         $ctrlID
         | The control ID of a control on the $formHandle form
         $eventName
         | The event naame to be registered for. Must be one of the above event names
         $function
         | The function name to be called when the event occurs
         $tag
         | A tag to associated to the object event
     If the Function (Func) does not exist - the event will not be triggered.
Event properties
----------------
     When a registered event is invoked against an object - the associated function is called.
     To gain access to the event properties - the code needs to get the event property using the _RegEvent_GetEventProperty($name) function.
     The available $name properties are:
     object properites
         formHandle  = handle to the form
         ctrlID      = control ID (for a control object)
         tag             = tag name of the object (if set by the code)
     event properties
         dragObject  = handle of object being dragged
         focusLostObject = handle of the object that has lost focus
         focusGotObject = handle of the object that has got focus
         keyName         = name of the key pressed
         keyValue    = value of the key pressed
         keyState    = state of the key (0 = up, 1 = down)
         keyShift    = state of the SHIFT key
         keyCtrl         = state of the CTRL key
         keyAlt      = state of the ALT key
         keyTicks    = the machine tick value of the key event
         mouseButton     = the last mouse button pressed
         mouseObject     = the object the mouse is over
         mouseX      = the X coordinate of the mouse
         mouseY      = the Y coordinate of the mouse
         mouseTicks  = the machine tick value of the mouse event
     It is the codes responsibility to request the appropriate event property for the event being handle.
     Using the wrong property name results in "<invalid property name>" being returned
Unregistering events
--------------------
     A registered event can be unregistered buy the _REgEvent_UnregEvent(($ID, $eventName) function
     $ID is supplied within an event by the $_RegEvent_EventID variable; or returned by the _RegEvent_GetID($handle) function

Attachment:

RegisterEvent v1.0.zip

Contains:

  • RegisterEvent.au3
  • Example.au3
  • Example.exe
  • copies of InputEvent,au3 & InputEvent.dll (required by RegisterEvent.au3)

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  

×