wxSplitterEvent(3erl)

πŸ’… wxSplitterEvent β€” like, the whole Erlang module definition, bestie

okay so this page is the wxSplitterEvent page from the Erlang manual (module definition vibes), and I'm gonna walk you through every single bit of it, no skips, no cap. grab a snack. πŸ“


✨ NAME ✨

wxSplitterEvent β€” literally just the functions for the wxSplitterEvent class. that's the whole name. iconic, brief, we love her. πŸ‘‘


🌸 DESCRIPTION 🌸

so this class represents the events generated by a splitter control. that's it. that's the gig. πŸŽ€

and here's the tea: there's only one event class, but the data associated with the different events is not the same β€” so not all accessor functions may be called for each event. the docs will tell you which kind of event(s) each accessor function actually makes sense for. call it for a different type of event and you get an assert failure (in debug mode) and meaningless results back. 😭 like bestie that's not a vibe.

lowkey important: debug-mode assert failure + meaningless return values if you use an accessor on the wrong event type. don't do it. πŸ’€

See: wxSplitterWindow, Overview events

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

wxWidgets docs: wxSplitterEvent


πŸ¦‹ EVENTS πŸ¦‹

Use wxEvtHandler:connect/3 with wxSplitterEventType to subscribe to events of this type. that's the whole move. subscribe and slay. ✨


πŸ’œ DATA TYPES πŸ’œ

here's where it gets a lil type-theory-y, stay with me:

wxSplitterEvent() = wx:wx_object()

wxSplitter() = #wxSplitter{type = wxSplitterEvent:wxSplitterEventType()}

wxSplitterEventType() =
    command_splitter_sash_pos_changed |
    command_splitter_sash_pos_changing |
    command_splitter_doubleclicked | command_splitter_unsplit

four event types, one record, zero notes. 🌈


πŸ‘‘ EXPORTS πŸ‘‘

πŸŽ€ getSashPosition(This) -> integer()

Types:

This = wxSplitterEvent()

returns the new sash position. that's it, that's the function.

may only be called while processing wxEVT_SPLITTER_SASH_POS_CHANGING and wxEVT_SPLITTER_SASH_POS_CHANGED events. any other time? assert failure city. πŸ™ˆ


πŸŽ€ getX(This) -> integer()

Types:

This = wxSplitterEvent()

returns the x coordinate of the double-click point. the horizontal one, bestie.

may only be called while processing wxEVT_SPLITTER_DOUBLECLICKED events. πŸ–±οΈ


πŸŽ€ getY(This) -> integer()

Types:

This = wxSplitterEvent()

returns the y coordinate of the double-click point. the vertical one. her sister. 🫢

may only be called while processing wxEVT_SPLITTER_DOUBLECLICKED events.


πŸŽ€ getWindowBeingRemoved(This) -> wxWindow:wxWindow()

Types:

This = wxSplitterEvent()

returns a pointer to the window being removed when a splitter window is unsplit. bye-bye window 🫑

may only be called while processing wxEVT_SPLITTER_UNSPLIT events.


πŸŽ€ setSashPosition(This, Pos) -> ok

Types:

This = wxSplitterEvent()
Pos = integer()

okay so this one's got layers, pay attention:

  • in the case of wxEVT_SPLITTER_SASH_POS_CHANGED events, it sets the new sash position.
  • in the case of wxEVT_SPLITTER_SASH_POS_CHANGING events, it sets the new tracking bar position so that the visual feedback during dragging will actually represent the change that will actually take place. set it to -1 from the event handler code to prevent repositioning. 🚫

may only be called while processing wxEVT_SPLITTER_SASH_POS_CHANGING and wxEVT_SPLITTER_SASH_POS_CHANGED events.


and that's the whole page, bestie. every single function, every single caveat, nothing dropped. πŸ’…βœ¨


sign-off szn: this lil masterpiece was brought to you by the wxWidgets team 🌈, for wx 2.2.2.1, and this page is wxSplitterEvent(3erl) β€” manual name folded in near the top like we promised, periodt. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from