Skip to main content

WMCustomControlAction

WMCustomControlAction

This structure is passed to action procedures for custom controls created using the CustomControl operation.

Structure WMCustomControlAction
char ctrlName[MAX_OBJ_NAME+1] // Control name
char win[MAX_WIN_PATH+1] // Host window or subwindow name
STRUCT Rect winRect // Local coordinates of host window
STRUCT Rect ctrlRect // Enclosing rectangle of the control
STRUCT Point mouseLoc // Mouse location
Int32 eventCode // See details below
Int32 eventMod // See Control Structure eventMod Field
String userData // Primary unnamed user data
Int32 blockReentry // Obsolete, see Control Structure blockReentry Field
Int32 missedEvents // TRUE when events occurred but the user
// function was not available for action
Int32 mode // General purpose

// Used only when eventCode==kCCE_frame
Int32 curFrame // Input and output

// Used when eventCode is kCCE_mousemoved, kCCE_mouseenter or kCCE_mouseleave
Int32 needAction // See below for details

// These fields are valid only with value=varName
Int32 isVariable // TRUE if varName is a variable (numeric or string)
Int32 isWave // TRUE if varName referenced a wave
Int32 isString // TRUE if varName is a String type
NVAR nVal // Valid if isVariable and not isString
SVAR sVal // Valid if isVariable and isString
WAVE nWave // Valid if isWave and not isString
WAVE/T sWave // Valid if isWave and isString
Int32 rowIndex // Valid if isWave, this is the row index unless rowLabel is not empty
char rowLabel[MAX_OBJ_NAME+1] // Wave row label

// These fields are valid only when eventCode==kCCE_char
Int32 kbChar // Keyboard key character code
// This field cannot represent non-ASCII text such as accented characters. Use keyText instead.
Int32 specialKeyCode // See Keyboard Events - Added in Igor Pro 7
char keyText[16] // UTF-8 string representing key struck - Added in Igor Pro 7
Int32 kbMods // Keyboard key modifiers bit field. See details below.
EndStructure

The constants used to specify the size of structure char arrays are internal to Igor Pro and may change.

WMCustomControlAction eventCode Field

When determining the state of the eventCode member in the WMCustomControlAction structure, the various values you use are listed in the following table. You can define the kCCE symbolic constants by adding this to your procedure file:

#include <CustomControl Definitions>
Event CodeDescription
kCCE_mousedown = 1Mouse down in control.
kCCE_mouseup = 2Mouse up in control.
kCCE_mouseup_out = 3Mouse up outside control.
kCCE_mousemoved = 4Mouse moved (happens only when mouse is over the control).
kCCE_enter = 5Mouse entered control.
kCCE_leave = 6Mouse left control.
kCCE_mouseDraggedOutside = 7The mouse moved while it was outside the control. This event is delivered only after the mouse is pressed inside the control and dragged outside. While the mouse is inside the control, kCCE_mousemoved is delivered whether the mouse button is up or down.
kCCE_draw = 10Time to draw custom content.
kCCE_mode = 11Sent when executing CustomControl name, mode=m.
kCCE_frame = 12Sent before drawing a subframe of a custom picture.
kCCE_dispose = 13Sent as the control is killed.
kCCE_modernize = 14Sent when dependency (variable or wave set by value=varName parameter) fires. It will also get draw events, which probably don't need a response.
kCCE_tab = 15Sent when user tabs into the control. If you want keystrokes (kCCE_char), then set needAction.
kCCE_char = 16Sent on keyboard events. Stores the keyboard character in kbChar and modifiers bit field is stored in kbMods. Sets needAction if key event was used and requires a redraw.
kCCE_drawOSBM = 17Called after drawing pict from picture parameter into an offscreen bitmap. You can draw custom content here.
kCCE_idle = 18Idle event typically used to blink insertion points etc. Set needAction to force the control to redraw. Sent only when the host window is topmost.

WMCustomControl needAction Field

The meaning of needAction depends on the event.

Events kCCE_mousemoved, kCCE_enter, kCCE_leave, and kCCE_mouseDraggedOutside set needAction to TRUE to force redraw, which is normally not done for these events.

Events kCCE_tab and kCCE_mousedown set needAction to TRUE to request keyboard focus (and get kCCE_char events).

Event kCCE_idle sets needAction to TRUE to request redraw.

WMCustomControl kbMods Field

Bit 0: Not supported.

Bit 1: Shift

Bit 2: Alpha Lock. Not supported in Igor 7 or later.

Bit 3: Alt

Bit 4: Windows key