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

Glossary Item Box

Specifies the keyboard event.

Syntax

C# 
public enum KeyboardEvent : System.Enum 

Members

MemberDescription
DownThe key down event.
PressThe key press event.
UpThe key up event.

Example

The following code example demonstrates uses of the KeyboardEvent enumeration.
C#Copy Code
// send the key "a"
string result = Emulator.SendKey("Window", 200, 200, System.Windows.Forms.Keys.A, KeyboardEvent.Press);
// check result
if (result == "ok" && !Emulator.ErrorDetected) return "Key was sent";
else return "Fail";
PHPCopy Code
// send the key "a"
$result = Emulator::SendKey("Window", 200, 200, System\Windows\Forms\Keys.A, KeyboardEvent::Press);
// check result
if ($result == "ok" && !Emulator::ErrorDetected) return "Key was sent";
else return "Fail";
C#Copy Code
// find the html element
HtmlElement he = instance.ActiveTab.FindElementByTag("input:text", 0);
// check the element
if (!he.IsVoid)
{
    // send key
    string result = Emulator.SendKey(instance.ActiveTab.Handle,System.Windows.Forms.Keys.Z, KeyboardEvent.Down); 
    // send result
    if (result == "ok" && !Emulator.ErrorDetected) return "Key was sent";
    return "Fail";
}
return "Element not found";
PHPCopy Code
// find the html element
$he = $instance->ActiveTab->FindElementByTag("input:text", 0);
// check the element
if (!$he->IsVoid)
{
    // send key
    $result = Emulator::SendKey($instance->ActiveTab->Handle, System\Windows\Forms\Keys::Z, KeyboardEvent::Down); 
    // send result
    if ($result == "ok" && !Emulator.ErrorDetected) return "Key was sent";
    return "Fail";
}
return "Element not found";

Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         ZennoLab.Emulation.KeyboardEvent

Requirements

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

See Also

© 2014 All Rights Reserved.