---
name: "SoButtonEvent"
section: "3iv"
platform: "linux"
package: "inventor-doc"
version: "2.1.6+ds-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SoButtonEvent/3iv"
---

# SoButtonEvent(3iv)

base class for all button events

## NAME

SoButtonEvent — base class for all button events

## INHERITS FROM

SoEvent \> SoButtonEvent

## SYNOPSIS

**#include \<Inventor/events/SoButtonEvent.h\>**

**enum State {** **SoButtonEvent::UP**	Button up event\
 **SoButtonEvent::DOWN**	Button down event\
 **SoButtonEvent::UNKNOWN**	Button in unknown state\
 **}**

Methods from class SoButtonEvent:

	**SoButtonEvent()**\
 **static SoType**	**getClassTypeId()**\
 **void**	**setState(SoButtonEvent::State s)**\
 **SoButtonEvent::State**	**getState() const**

Methods from class SoEvent:

**virtual SoType**	**getTypeId() const**\
 **SbBool**	**isOfType(SoType type) const**\
 **void**	**setTime(SbTime t)**\
 **SbTime**	**getTime() const**\
 **void**	**setPosition(const SbVec2s &p)**\
 **const SbVec2s &**	**getPosition() const**\
 **const SbVec2s &**	**getPosition(const SbViewportRegion &vpRgn) const**\
 **const SbVec2f &**	**getNormalizedPosition(const SbViewportRegion &vpRgn) const**\
 **void**	**setShiftDown(SbBool isDown)**\
 **void**	**setCtrlDown(SbBool isDown)**\
 **void**	**setAltDown(SbBool isDown)**\
 **SbBool**	**wasShiftDown() const**\
 **SbBool**	**wasCtrlDown() const**\
 **SbBool**	**wasAltDown() const**

## DESCRIPTION

**SoButtonEvent** represents generic button press and release events in the Inventor event model. It is the base class for device-specific button events, namely **SoKeyboardEvent**, **SoMouseButtonEvent**, and **SoSpaceballButtonEvent**. This class stores the down/up state of the button when the event occurred.

## METHODS

	**SoButtonEvent()**\
 Constructor.

**static SoType**	**getClassTypeId()**\
 Return the type id for the **SoButtonEvent** class.

**void**	**setState(SoButtonEvent::State s)**\
 **SoButtonEvent::State**	**getState() const**\
 Set and get the state of the button.

## SEE ALSO

**SoEvent, SoKeyboardEvent, SoLocation2Event, SoMotion3Event, SoMouseButtonEvent, SoSpaceballButtonEvent, SoHandleEventAction, SoEventCallback, SoSelection, SoInteraction, SoXtDevice**
