wxPaintEvent(3erl)
๐ NAME ๐
wxPaintEvent(3erl) โ straight out of the Erlang Module Definition manual โ is literally Functions for wxPaintEvent class. Bestie, this is your paint-event bestie page. ๐จโจ
๐ DESCRIPTION ๐
Okay so picture this: a paint event gets sent when a windowโs contents need to be repainted. Thatโs the whole vibe check. ๐๏ธ
The handler of this event must create a wxPaintDC object and use it for painting the window contents. No cap, thatโs mandatory. For example:
(the source page says โFor example:โ right here, but thereโs no actual snippet shown โ not me staring at an empty example block ๐ญ)
Important bestie warning: you must not create other kinds ofwxDCโ likewxClientDCorwxWindowDCโ inEVT_PAINThandlers. And also donโt createwxPaintDCoutside of these event handlers. Periodt. ๐ซ๐
You can optimize painting by retrieving the rectangles that have been damaged and only repainting those. Iconic efficiency behavior. The rectangles are in terms of the client area, and theyโre unscrolled, so youโll need to do some calculations using the current view position to obtain logical, scrolled units. Math era, unfortunately. ๐งฎโจ
Here is an example of using the wxRegionIterator (not implemented in wx) class:
(again, the source page promises an example right here but shows no code โ the snippet is lowkey MIA ๐ซ )
Remark: please notice that in general it is impossible to change the drawing of a standard control (such as wxButton), so you shouldnโt attempt to handle paint events for them. Even if it might work on some platforms, this is inherently not portable and wonโt work everywhere. So likeโฆ donโt do it. ๐
See: Overview events ๐
This class is derived (and can use functions) from: wxEvent. Family tree slay. ๐ณ๐
wxWidgets docs: wxPaintEvent ๐
โจ EVENTS โจ
Use wxEvtHandler:connect/3 with wxPaintEventType to subscribe to events of this type. Thatโs the subscription link, bestie โ click subscribe and get your paint-event notifications. ๐๐
๐ DATA TYPES ๐
wxPaintEvent() = wx:wx_object()
wxPaint() = #wxPaint{type = wxPaintEvent:wxPaintEventType()}
wxPaintEventType() = paint
Literal data-type royalty. paint is the only type in the wxPaintEventType() lineup here, and it ate. ๐๐
shoutout to the wxWidgets team โ source/version wx 2.2.2.1, manual page wxPaintEvent(3erl) โ for this whole paint-event situation. The footer doesnโt give us a date, so no fake-date energy from me, bestie. ๐ซถ๐โจ
๐ฆ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 ยท Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 ยท Apache-2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms