ZennoLab Assemblies Documentation
MouseButton Enumeration
Example  See Also  Send Feedback
ZennoLab.Emulation Assembly > ZennoLab.Emulation Namespace : MouseButton Enumeration

Glossary Item Box

Specifies the mouse button.

Syntax

C# 
public enum MouseButton : System.Enum 

Members

MemberDescription
LeftThe left mouse button.
RightThe right mouse button.

Example

The following code example demonstrates uses of the MouseButton enumeration.
C#Copy Code
// show the save file dialog
string result = Emulator.MouseClick("Simple window", MouseButton.Left, MouseButtonEvent.Click, 200, 200);
// wait a little bit
System.Threading.Thread.Sleep(2000);
// if mouse click was successful
if (result == "ok" && !Emulator.ErrorDetected)
{
    // click on button with caption "Save"
    result = Emulator.ButtonClick("Save as", "Save");
    // make answer
    if (result == "ok" && !Emulator.ErrorDetected) return "All done";
    else return "Fail";
}
PHPCopy Code
// show the save file dialog
$result = Emulator::MouseClick("Simple window", MouseButton::Left, MouseButtonEvent::Click, 200, 200);
// wait a little bit
System\Threading\Thread::Sleep(2000);
// if mouse click was successful
if ($result == "ok" && !Emulator::ErrorDetected)
{
    // click on button with caption "Save"
    $result = Emulator::ButtonClick("Save as", "Save");
    // make answer
    if ($result == "ok" && !Emulator::ErrorDetected) return "All done";
    else return "Fail";
}
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 = 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";

Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         ZennoLab.Emulation.MouseButton

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.