Control Events Versus Classic Control Messages

The control event constants defined by the Carbon Event Manager generally map to control messages sent to control defprocs (CDEFs) as shown in Table A-1.

Table A-1  Control Events versus Control defproc messages

Control event constant

Control defproc message(s)

kEventControlInitialize

initCntlkControlMsgTestNewMsgSupportkControlMsgGetFeatures (in that order)

kEventControlDispose

dispCntl

kEventControlGetOptimalBounds

kControlMsgCalcBestRect

kEventControlDefInitialize

Same as for kEventControlInitialize.

kEventControlDefDispose

Same as for kEventControlDispose

kEventControlHit

No equivalent message

kEventControlSimulateHit

No equivalent message

kEventControlHitTest

testCntl

kEventControlDraw

drawCntl

kEventControlApplyBackground

kControlMsgSetUpBackground

kEventControlApplyTextColor

kControlMsgApplyTextColor

kEventControlSetFocusPart

kControlMsgFocus

kEventControlGetFocusPart

No equivalent message.

kEventControlActivate

kControlMsgActivate (with param = 1)

kEventControlDeactivate

kControlMsgActivate (with param = 0)

kEventControlSetCursor

kControlMsgSetCursor

kEventControlContextualMenuClick

kControlMsgContextualMenuClick

kEventControlTrack

kControlMsgHandleTracking

kEventControlGetScrollToHereStartPoint

No equivalent message.

kEventControlGetIndicatorDragConstraint

thumbCntl

kEventControlIndicatorMoved

kControlMsgDrawGhost (for nonlive tracking) or kControlMsgCalcValueFromPos (for live tracking).

kEventControlGhostingFinished

posCntl

kEventControlGetActionProcPart

No equivalent message.

kEventControlGetPartRegion

kControlMsgGetRegion for controls that support GetRegion, calcCntlRgn or calcThumbRgn otherwise.

kEventControlGetPartBounds

No equivalent message.

kEventControlSetData

kControlMsgSetData

kEventControlGetData

kControlMsgGetData

kEventControlValueFieldChanged

drawCntl with param = kControlIndicatorPart

kEventControlAddedSubControl

kControlMsgSubControlAdded

kEventControlRemovingSubControl

kControlMsgSubControlRemoved

kEventControlArbitraryMessage

Anything sent using SendControlMessage

kEventWindowGetClickActivation (of event class kEventClassWindow)

kControlMsgGetClickActivation

Some messages are no longer supported, as shown in Table A-2

Table A-2  Unsupported CDEF messages

Message

Why No Carbon Event Equivalent

calcCRgns

Obsolete. Use kControlMsgGetRegion instead.

autoTrack

Use kControlMsgHandleTracking instead.

dragCntl

Obsolete. No one needs to use this anymore.

drawThumbOutline

Obsolete. Use kControlDrawMsgGhost, kControlMsgCalcValueFromPos, and posCntl instead.

kControlMsgKeyDown

Only marginal support available on Mac OS X using kEventControlArbitraryMessage. Use kEventTextInput class of Carbon events instead.

kControlMsgIdle

Only marginal support available on Mac OS X using kEventControlArbitraryMessage. The CDEF should install a timer instead.

kControlMsgSubValueChanged

Only marginal support available on Mac OS X using kEventControlArbitraryMessage. CDEF should install kEventControlValueFieldChanged on its children instead.

kControlMsgFlatten

Obsolete. Never implemented.