Search documentation of wx

# View Source wxJoystickEvent (wx v2.4.2)

Functions for wxJoystickEvent class

This event class contains information about joystick events, particularly events received by windows.

See: `wxJoystick` (not implemented in wx)

This class is derived (and can use functions) from: `wxEvent`

wxWidgets docs: wxJoystickEvent

## Events

Use `wxEvtHandler:connect/3` with `wxJoystickEventType` to subscribe to events of this type.

# Summary

## Types

wxJoystick()
wxJoystickEvent()
wxJoystickEventType()

## Functions

buttonDown(This)
buttonDown/2

Returns true if the event was a down event from the specified button (or any button).

buttonIsDown(This)
buttonIsDown/2

Returns true if the specified button (or any button) was in a down state.

buttonUp(This)
buttonUp/2

Returns true if the event was an up event from the specified button (or any button).

getButtonChange(This)

Returns the identifier of the button changing state.

getButtonState(This)

Returns the down state of the buttons.

getJoystick(This)

Returns the identifier of the joystick generating the event - one of wxJOYSTICK1 and wxJOYSTICK2.

getPosition(This)

Returns the x, y position of the joystick event.

getZPosition(This)

Returns the z position of the joystick event.

isButton(This)

Returns true if this was a button up or down event (`not` 'is any button down?').

isMove(This)

Returns true if this was an x, y move event.

isZMove(This)

Returns true if this was a z move event.

# Types

Link to this type

# wxJoystick()

View Source

    -type wxJoystick() ::
              #wxJoystick{type :: wxJoystickEvent:wxJoystickEventType(),
                          pos :: {X :: integer(), Y :: integer()},
                          zPosition :: integer(),
                          buttonChange :: integer(),
                          buttonState :: integer(),
                          joyStick :: integer()}.

Link to this type

# wxJoystickEvent()

View Source

    -type wxJoystickEvent() :: wx:wx_object().

Link to this type

# wxJoystickEventType()

View Source

    -type wxJoystickEventType() :: joy_button_down | joy_button_up | joy_move | joy_zmove.

# Functions

Link to this function

# buttonDown(This)

View Source

    -spec buttonDown(This) -> boolean() when This :: wxJoystickEvent().

Link to this function

# buttonDown/2

View Source

    -spec buttonDown(This, [Option]) -> boolean() when This :: wxJoystickEvent(), Option :: {but, integer()}.

Returns true if the event was a down event from the specified button (or any button).

Link to this function

# buttonIsDown(This)

View Source

    -spec buttonIsDown(This) -> boolean() when This :: wxJoystickEvent().

Link to this function

# buttonIsDown/2

View Source

    -spec buttonIsDown(This, [Option]) -> boolean()
                          when This :: wxJoystickEvent(), Option :: {but, integer()}.

Returns true if the specified button (or any button) was in a down state.

Link to this function

# buttonUp(This)

View Source

    -spec buttonUp(This) -> boolean() when This :: wxJoystickEvent().

Link to this function

# buttonUp/2

View Source

    -spec buttonUp(This, [Option]) -> boolean() when This :: wxJoystickEvent(), Option :: {but, integer()}.

Returns true if the event was an up event from the specified button (or any button).

Link to this function

# getButtonChange(This)

View Source

    -spec getButtonChange(This) -> integer() when This :: wxJoystickEvent().

Returns the identifier of the button changing state.

The return value is where `n` is the index of the button changing state, which can also be retrieved using `GetButtonOrdinal()` (not implemented in wx).

Note that for `n` equal to 1, 2, 3 or 4 there are predefined `wxJOY_BUTTONn` constants which can be used for more clarity, however these constants are not defined for the buttons beyond the first four.

Link to this function

# getButtonState(This)

View Source

    -spec getButtonState(This) -> integer() when This :: wxJoystickEvent().

Returns the down state of the buttons.

This is a `wxJOY_BUTTONn` identifier, where `n` is one of 1, 2, 3, 4.

Link to this function

# getJoystick(This)

View Source

    -spec getJoystick(This) -> integer() when This :: wxJoystickEvent().

Returns the identifier of the joystick generating the event - one of wxJOYSTICK1 and wxJOYSTICK2.

Link to this function

# getPosition(This)

View Source

    -spec getPosition(This) -> {X :: integer(), Y :: integer()} when This :: wxJoystickEvent().

Returns the x, y position of the joystick event.

These coordinates are valid for all the events except wxEVT_JOY_ZMOVE.

Link to this function

# getZPosition(This)

View Source

    -spec getZPosition(This) -> integer() when This :: wxJoystickEvent().

Returns the z position of the joystick event.

This method can only be used for wxEVT_JOY_ZMOVE events.

Link to this function

# isButton(This)

View Source

    -spec isButton(This) -> boolean() when This :: wxJoystickEvent().

Returns true if this was a button up or down event (`not` 'is any button down?').

Link to this function

# isMove(This)

View Source

    -spec isMove(This) -> boolean() when This :: wxJoystickEvent().

Returns true if this was an x, y move event.

Link to this function

# isZMove(This)

View Source

    -spec isZMove(This) -> boolean() when This :: wxJoystickEvent().

Returns true if this was a z move event.