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

# SoMouseButtonEvent(3iv)

mouse button press and release events

## NAME

SoMouseButtonEvent — mouse button press and release events

## INHERITS FROM

SoEvent \> SoButtonEvent \> SoMouseButtonEvent

## SYNOPSIS

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

**#define SO\_MOUSE\_PRESS\_EVENT(EVENT,BUTTON)**\
     **(SoMouseButtonEvent::isButtonPressEvent(EVENT,SoMouseButtonEvent::BUTTON))** \
 **#define SO\_MOUSE\_RELEASE\_EVENT(EVENT,BUTTON)**\
     **(SoMouseButtonEvent::isButtonReleaseEvent(EVENT,SoMouseButtonEvent::BUTTON))**

**enum Button {** **SoMouseButtonEvent::ANY**	Any button\
 **SoMouseButtonEvent::BUTTON1**	First mouse button\
 **SoMouseButtonEvent::BUTTON2**	Second mouse button\
 **SoMouseButtonEvent::BUTTON3**	Third mouse button\
 **}**

Methods from class SoMouseButtonEvent:

	**SoMouseButtonEvent()**\
 **static SoType**	**getClassTypeId()**\
 **void**	**setButton(SoMouseButtonEvent::Button b)**\
 **SoMouseButtonEvent::Button**	**getButton() const**\
 **static SbBool**	**isButtonPressEvent(const SoEvent \*e, SoMouseButtonEvent::Button whichButton)**\
 **static SbBool**	**isButtonReleaseEvent(const SoEvent \*e, SoMouseButtonEvent::Button whichButton)**

Methods from class SoButtonEvent:

**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

**SoMouseButtonEvent** represents mouse button press and release events in the Inventor event model.

## METHODS

	**SoMouseButtonEvent()**\
 Constructor.

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

**void**	**setButton(SoMouseButtonEvent::Button b)**\
 **SoMouseButtonEvent::Button**	**getButton() const**\
 Set and get which mouse button generated the event.

**static SbBool**	**isButtonPressEvent(const SoEvent \*e, SoMouseButtonEvent::Button whichButton)**\
 **static SbBool**	**isButtonReleaseEvent(const SoEvent \*e, SoMouseButtonEvent::Button whichButton)**\
 Returns whether the passed event is a mouse button press or release event of the passed button. When **SoMouseButtonEvent::ANY** is passed, this returns TRUE if the event represents a button press or release of any mouse button.

## SEE ALSO

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