KeyState

Methods2

The KeyState API is used to display small icons to the user indicating the current shifted state of the hardware keyboard. The KeyState indicator will display icons for Shift, Alt, Control, Function, Caps, Num lock and Orange key states, growing from the right as necessary if more than one key state is set at once. This API is only supported on a subset of Symbol Technologies' Windows Mobile / CE / Embedded handheld devices (see remarks).

Enabling the API

In order to use this API you must include the following extension in your build.yml. :::ruby extensions: [“indicators”]

The indicators extension is also included automatically if you specify the following in your build.yml. :::ruby app_type: “rhoelements”

If you are building a Windows Mobile or Windows CE app with this API, you must set your app_type as “rhoelements” in your build.yml as shown here.

JavaScript Usage

Be sure to review the JavaScript API Usage guide for important information about using this API in JavaScript.

Ruby Usage

Be sure to review the Ruby API Usage guide for important information about using this API in Ruby.

Methods

hideStates
()

Stops showing keystate icons representing the shifted state of the hardware keyboard.

Synchronous Return:

  • Void

Method Access:

  • Class Method: This method can only be accessed via the API class object.
    • JavaScript: Rho.KeyState.hideStates()
    • Ruby: Rho::KeyState.hideStates()
showStates
(HASH propertyMap)

Display keystate icons representing the shifted state of the hardware keyboard.

Parameters

  • propertyMap : HASH Optional

    The properties associated with the keystate indicator, its size and position.

    Not specifying any properties will display the keystate indicators at the bottom right hand corner of the screen.

    • right : INTEGER Default: [Keystate Indicators start at the bottom right of the screen]

      The absolute horizontal position of the keystate indicators in pixels. This is the rightmost edge of the rightmost indicator, where multiple indicators are displayed simultaneously they will grow from right to left.

    • top : INTEGER Default: [Keystate Indicators start at the bottom right of the screen]

      The absolute vertical position of the keystate indicators in pixels.

    • width : INTEGER Default: [A sensible width based on Screen Resolution]

      The width of each keystate indicator in pixels.

    • height : INTEGER Default: [A sensible height based on Screen Resolution]

      The width of each keystate indicator in pixels.

Synchronous Return:

  • Void

Method Access:

  • Class Method: This method can only be accessed via the API class object.
    • JavaScript: Rho.KeyState.showStates(HASH propertyMap)
    • Ruby: Rho::KeyState.showStates(HASH propertyMap)

Examples

Show the Keystate Indicators

If you just want to display the keystate indicators in their default positions with size 25x25 pixels then call as follows.

function show_keystates(){
    Rho.Keystate.showStates({width:25;height:25});
}
                        
def show_keystates
    Rho::Keystate.showStates({width:25;height:25})
end
                        

Remarks

Devices lacking support

Due to platform limitations this API is not available on the following Zebra Technologies devices:

  • ES400
  • MC45
  • MC65
  • VC70
  • MC45
  • Workabout Pro 4
Rotating the Screen

The keystate indicator positions are absolute and so when rotating the screen you should also reposition the keystate accordingly to accommodate the new screen layout.