ZennoLab Assemblies Documentation
MouseClick(Int32,MouseButton,MouseButtonEvent,Int32,Int32) Method
See Also  Example Send Feedback
ZennoLab.Emulation Assembly > ZennoLab.Emulation Namespace > Emulator Class > MouseClick Method : MouseClick(Int32,MouseButton,MouseButtonEvent,Int32,Int32) Method
handle

Type: System.Int32

The handle of the window.

button

Type: ZennoLab.Emulation.MouseButton

The mouse button for emulation.

buttonEvent

Type: ZennoLab.Emulation.MouseButtonEvent

The event of mouse button for emulation.

x

Type: System.Int32

The x coordinate relative to the window.

y

Type: System.Int32

The y coordinate relative to the window.

Glossary Item Box

Emulates the mouse's events in the window with specified handle.

Syntax

C# 
public static string MouseClick( 
   int handle,
   MouseButton button,
   MouseButtonEvent buttonEvent,
   int x,
   int y
)

Parameters

handle

Type: System.Int32

The handle of the window.

button

Type: ZennoLab.Emulation.MouseButton

The mouse button for emulation.

buttonEvent

Type: ZennoLab.Emulation.MouseButtonEvent

The event of mouse button for emulation.

x

Type: System.Int32

The x coordinate relative to the window.

y

Type: System.Int32

The y coordinate relative to the window.

Return Value

Type: System.String

The answer with information about the success of the current command's execution. If current command was successful then this answer is "ok"; otherwise message describing the error.

Example

The following code example demonstrates uses of the MouseClick method. First of all this code searches the html element by specified search conditions. And next performs the click to the specified point from the active tab's window of the instance.
C#Copy Code
// find the html element
HtmlElement he = instance.ActiveTab.FindElementByTag("input:submit", 0);
// check the element
if (!he.IsVoid)
{
    // click
    string result = Emulator.MouseClick(instance.ActiveTab.Handle, 
        MouseButton.Left, MouseButtonEvent.Click, he.DisplacementInTabWindow.X + 10, he.DisplacementInTabWindow.Y + 10);
    // click was performed
    if (result == "ok") return "All done";
    // fail
    return "Fail";
}
// element not found
return "Element not found";
PHPCopy Code
// find the html element
$he = $instance->ActiveTab->FindElementByTag("input:submit", 0);
// check the element
if (!$he->IsVoid)
{
    // click
    $result = ZennoLab\Emulation\Emulator::MouseClick($instance->ActiveTab->Handle, 
        ZennoLab\Emulation\MouseButton::Left, MouseButtonEvent::Click, $he->DisplacementInTabWindow->X + 10, $he->DisplacementInTabWindow->Y + 10);
    // click was performed
    if ($result == "ok") return "All done";
    // fail
    return "Fail";
}
// element not found
return "Element not found";

Requirements

Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.