SOKEYBOARDEVENT(3iv)

πŸ’– SoKeyboardEvent β€” like, the whole manual, but make it make sense πŸ’–

okay bestie, welcome to SoKeyboardEvent(3IV) β€” yes that's the manual name, it's giving very "openInventor era" and honestly? iconic. This is the page all about keyboard key press and release events. Keys go down, keys come up, we vibe. Let's get into it 🎹✨


🌸 INHERITS FROM 🌸

the family tree, and yes it's a whole lineage:

SoEvent > SoButtonEvent > SoKeyboardEvent

so like, everything your ancestors can do? you can do too. nepotism but make it C++ πŸ’…


✨ SYNOPSIS ✨

First things first, the include. yes you need it, no you can't skip it:

#include <Inventor/events/SoKeyboardEvent.h>

then these two macros, which are basically the "is this even happening" checks:

#define SO_KEY_PRESS_EVENT(EVENT,KEY)
      (SoKeyboardEvent::isKeyPressEvent(EVENT,SoKeyboardEvent::KEY))
#define SO_KEY_RELEASE_EVENT(EVENT,KEY)
      (SoKeyboardEvent::isKeyReleaseEvent(EVENT,SoKeyboardEvent::KEY))

look at them. they expand into the static checker calls. adorable. no cap 🫢


πŸŽ€ enum Key β€” the big list, and yes we're doing all of them πŸŽ€

⭐ Special

  • SoKeyboardEvent::ANY β€” the wildcard bestie. special constant for any key 🌈

πŸ’… Modifiers β€” the "hold me while I click" girlies

  • SoKeyboardEvent::LEFT_SHIFT
  • SoKeyboardEvent::RIGHT_SHIFT
  • SoKeyboardEvent::LEFT_CONTROL
  • SoKeyboardEvent::RIGHT_CONTROL
  • SoKeyboardEvent::LEFT_ALT
  • SoKeyboardEvent::RIGHT_ALT

πŸ”’ Numbers β€” 0 through 9, all present and accounted for

  • SoKeyboardEvent::NUMBER_0
  • SoKeyboardEvent::NUMBER_1
  • SoKeyboardEvent::NUMBER_2
  • SoKeyboardEvent::NUMBER_3
  • SoKeyboardEvent::NUMBER_4
  • SoKeyboardEvent::NUMBER_5
  • SoKeyboardEvent::NUMBER_6
  • SoKeyboardEvent::NUMBER_7
  • SoKeyboardEvent::NUMBER_8
  • SoKeyboardEvent::NUMBER_9

πŸ¦‹ Letters β€” the whole alphabet, no skips

  • SoKeyboardEvent::A
  • SoKeyboardEvent::B
  • SoKeyboardEvent::C
  • SoKeyboardEvent::D
  • SoKeyboardEvent::E
  • SoKeyboardEvent::F
  • SoKeyboardEvent::G
  • SoKeyboardEvent::H
  • SoKeyboardEvent::I
  • SoKeyboardEvent::J
  • SoKeyboardEvent::K
  • SoKeyboardEvent::L
  • SoKeyboardEvent::M
  • SoKeyboardEvent::N
  • SoKeyboardEvent::O
  • SoKeyboardEvent::P
  • SoKeyboardEvent::Q
  • SoKeyboardEvent::R
  • SoKeyboardEvent::S
  • SoKeyboardEvent::T
  • SoKeyboardEvent::U
  • SoKeyboardEvent::V
  • SoKeyboardEvent::W
  • SoKeyboardEvent::X
  • SoKeyboardEvent::Y
  • SoKeyboardEvent::Z

🧭 Cursor control and motion β€” moving around, main character energy

  • SoKeyboardEvent::HOME
  • SoKeyboardEvent::LEFT_ARROW
  • SoKeyboardEvent::UP_ARROW
  • SoKeyboardEvent::RIGHT_ARROW
  • SoKeyboardEvent::DOWN_ARROW
  • SoKeyboardEvent::PAGE_UP
  • SoKeyboardEvent::PAGE_DOWN
  • SoKeyboardEvent::PRIOR
  • SoKeyboardEvent::NEXT
  • SoKeyboardEvent::END

🎹 Keypad functions β€” the numpad girlies, underrated fr fr

  • SoKeyboardEvent::PAD_ENTER
  • SoKeyboardEvent::PAD_F1
  • SoKeyboardEvent::PAD_F2
  • SoKeyboardEvent::PAD_F3
  • SoKeyboardEvent::PAD_F4
  • SoKeyboardEvent::PAD_0
  • SoKeyboardEvent::PAD_1
  • SoKeyboardEvent::PAD_2
  • SoKeyboardEvent::PAD_3
  • SoKeyboardEvent::PAD_4
  • SoKeyboardEvent::PAD_5
  • SoKeyboardEvent::PAD_6
  • SoKeyboardEvent::PAD_7
  • SoKeyboardEvent::PAD_8
  • SoKeyboardEvent::PAD_9
  • SoKeyboardEvent::PAD_ADD
  • SoKeyboardEvent::PAD_SUBTRACT
  • SoKeyboardEvent::PAD_MULTIPLY
  • SoKeyboardEvent::PAD_DIVIDE
  • SoKeyboardEvent::PAD_SPACE
  • SoKeyboardEvent::PAD_TAB
  • SoKeyboardEvent::PAD_INSERT
  • SoKeyboardEvent::PAD_DELETE
  • SoKeyboardEvent::PAD_PERIOD

πŸ”₯ Function keys β€” F1 through F12, the full dozen

  • SoKeyboardEvent::F1
  • SoKeyboardEvent::F2
  • SoKeyboardEvent::F3
  • SoKeyboardEvent::F4
  • SoKeyboardEvent::F5
  • SoKeyboardEvent::F6
  • SoKeyboardEvent::F7
  • SoKeyboardEvent::F8
  • SoKeyboardEvent::F9
  • SoKeyboardEvent::F10
  • SoKeyboardEvent::F11
  • SoKeyboardEvent::F12

πŸ“ Miscellaneous β€” the grab bag, the everything drawer

  • SoKeyboardEvent::BACKSPACE
  • SoKeyboardEvent::TAB
  • SoKeyboardEvent::RETURN
  • SoKeyboardEvent::ENTER
  • SoKeyboardEvent::PAUSE
  • SoKeyboardEvent::SCROLL_LOCK
  • SoKeyboardEvent::ESCAPE
  • SoKeyboardEvent::DELETE
  • SoKeyboardEvent::PRINT
  • SoKeyboardEvent::INSERT
  • SoKeyboardEvent::NUM_LOCK
  • SoKeyboardEvent::CAPS_LOCK
  • SoKeyboardEvent::SHIFT_LOCK
  • SoKeyboardEvent::SPACE
  • SoKeyboardEvent::APOSTROPHE
  • SoKeyboardEvent::COMMA
  • SoKeyboardEvent::MINUS
  • SoKeyboardEvent::PERIOD
  • SoKeyboardEvent::SLASH
  • SoKeyboardEvent::SEMICOLON
  • SoKeyboardEvent::EQUAL
  • SoKeyboardEvent::BRACKETLEFT
  • SoKeyboardEvent::BACKSLASH
  • SoKeyboardEvent::BRACKETRIGHT
  • SoKeyboardEvent::GRAVE

🫢 Methods from class SoKeyboardEvent

                     SoKeyboardEvent()
static SoType         getClassTypeId()
void                  setKey(SoKeyboardEvent::Key whichKey)
SoKeyboardEvent::Key  getKey() const
static SbBool         isKeyPressEvent(const SoEvent *e,
                            SoKeyboardEvent::Key whichKey)
static SbBool         isKeyReleaseEvent(const SoEvent *e,
                            SoKeyboardEvent::Key whichKey)
char                  getPrintableCharacter() const

πŸ’œ Methods from class SoButtonEvent β€” inherited, we love an heirloom

void                  setState(SoButtonEvent::State s)
SoButtonEvent::State  getState() const

πŸ’™ Methods from class SoEvent β€” the OG ancestor, grandparent energy

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 🌈

So like, here's the whole point: SoKeyboardEvent represents keyboard key press and release events in the Inventor event model.

that's it. that's the description. short and slay πŸ’–


πŸ’€ METHODS πŸ’€ β€” okay now the actual details, pay attention bestie

  • SoKeyboardEvent() β€” the constructor. it makes the thing. congrats you have an event πŸŽ€
  • static SoType getClassTypeId() β€” returns the type id for the SoKeyboardEvent class. it's the class's little ID card ✨
  • void setKey(SoKeyboardEvent::Key whichKey)
  • SoKeyboardEvent::Key getKey() const

β€” set and get which key generated the event. one direction writes it, the other reads it. matching set, we love a duo 🫢

  • static SbBool isKeyPressEvent(const SoEvent *e, SoKeyboardEvent::Key whichKey)
  • static SbBool isKeyReleaseEvent(const SoEvent *e, SoKeyboardEvent::Key whichKey)

β€” returns whether the passed event is a keyboard press or release event of the passed key. and here's the plot twist: when you pass SoKeyboardEvent::ANY, this returns TRUE if the event represents a keyboard press or release of any key. so ANY = "idc which key, just tell me if something happened" πŸ’…

  • char getPrintableCharacter() const

β€” a lil convenience routine that returns the character representing the key, if it's printable. and if it's not printable? it returns NULL ('\0'). so check before you trust it bestie 😭


🧚 SEE ALSO 🧚

the whole friend group, go read them too:

  • SoEvent
  • SoButtonEvent
  • SoLocation2Event
  • SoMotion3Event
  • SoMouseButtonEvent
  • SoSpaceballButtonEvent
  • SoHandleEventAction
  • SoEventCallback
  • SoSelection
  • SoInteraction
  • SoXtDevice

and that's the page, babe. this was the SoKeyboardEvent(3IV) manual β€” and ngl the footer field was literally just the name again with some empty parens, so no version, no date, nothing. iconic of it. anyway ily, go handle some events responsibly βœ¨πŸŽ€πŸ’–