Class

GameInputElement


Description

Manages an element of a GameInputDevice. Not supported on Linux.

Properties

Name

Type

Read-Only

Shared

Device

GameInputDevice

Name

String

Value

Integer

Property descriptions


GameInputElement.Device

Device As GameInputDevice

The device that owns this input element.

This property is read-only.

This example displays the name of the device that owns the selected element.

Var i, maxi As Integer
Var device As GameInputDevice
Var deviceElement As GameInputDevice
ElementPop.RemoveAllRows
device = mManager.Device(Listbox1.SelectedRowIndex) ' selected device in Device popup
deviceElement = device.Element(Listbox1.SelectedRowIndex).Device
MessageBox(deviceElement.Name)

GameInputElement.Name

Name As String

The human-readable name of the input element.

This property is read-only.

This example loads the list of elements belonging to the selected device into a PopupMenu named ElementPop.

Var i, maxi As Integer
Var device As GameInputDevice

ElementPop.RemoveAllRows
device = mManager.Device(Listbox1.SelectedRowIndex) //selected device in Device ListBox
If device <> Nil then
  maxi = device.ElementCount
  For i = 0 To maxi - 1
    ElementPop.AddRow(device.Element(i).Name)
  Next
End If

GameInputElement.Value

Value As Integer

The current value of this element.

This property is read-only.

This example loads the names and values corresponding to the selected device into a PopupMenu named ElementPop.

Var i, maxi As Integer
Var device As GameInputDevice

ElementPop.RemoveAllRows
device = mManager.Device(Listbox1.SelectedRowIndex) ' selected device in Device ListBox
If device <> Nil Then
  maxi = device.ElementCount
  For i = 0 To maxi - 1
    ElementPop.AddRow(Device.Element(i).Name + Str(device.Element(i).Value)
  Next
End If

Notes

A GameInputElement is a control on an input device used for gaming (or general user input via the keyboard and mouse). For example, the Fire button on a joystick control is an element, as are the standard mouse button and each of the keys on a keyboard. The Element method of the GameInputDevice class give you access to the elements of a specified device. You use the WaitForElement method of the GameInputManager class to detect input from an element.

Sample code

This example loads the list of elements belonging to the selected device into a PopupMenu named ElementPop. The connected devices are shown in a ListBox.

Var i, maxi As Integer
Var device As GameInputDevice

ElementPop.RemoveAllRows
device = mManager.Device(Listbox1.SelectedRowIndex) ' selected device in Device ListBox
If device <> Nil Then
  maxi = device.ElementCount
  For i = 0 To maxi - 1
    ElementPop.AddRow(Device.Element(i).Name)
  Next
End If

Compatibility

All project types on all supported operating systems.

See also

Object parent class; GameInputDevice, GameInputManager classes.