Docs » Autodocs » window_cl » WM_HANDLEINPUT
WM_HANDLEINPUT -- IDCMP input handling method
result = DoMethod( winobj, WM_HANDLEINPUT, &code );
This method is used to handle the IDCMP input of a window. Call
this method when the signal bit of the window's UserPort is
set. This method will return when it encounters a message that
requires notifying your application or when the message port no
longer contains messages for the window.
The return value is two-part. The upper word describes the
class of the event the value represents, and the lower word is
a modifier that describes the event.
Defined class return codes are:
WMHI_IGNORE Ignore this event
WMHI_LASTMSG No more messages
WMHI_CLOSEWINDOW Close gadget hit
WMHI_GADGETUP Gadget hit.
WMHI_INACTIVE Window went inactive.
WMHI_ACTIVE Window was activated.
WMHI_NEWSIZE Window was resized.
WMHI_MENUPICK A menu item was selected.
WMHI_MENUHELP Help was pressed in a menu.
WMHI_GADGETHELP A gadget sends a help message.
WMHI_ICONIFY Window should be iconified.
WMHI_UNICONIFY Window was deiconified.
WMHI_RAWKEY Raw key code
WMHI_VANILLAKEY Vanilla key code
WMHI_CHANGEWINDOW Window moved (or depth arranged)
The value of the lower word is defined for WMHI_GADGETUP and
WMHI_GADGETHELP as the ID of the gadget, and for WMHI_MENUPICK
and WMHI_MENUHELP as the menu code. WMHI_GAGDETHELP uses the
special values 0 and WMHI_GADGETMASK as messages "pointer not
over your window" and "pointer over your window but not over a
WMHI_RAWKEY returns the raw key ID of the key being
pressed (to get the qualifiers also, you have to use the IDCMP
hook), and WMHI_VANILLAKEY returns the ASCII value of the key.
WMHI_VANILLAKEY is only returned when you set IDCMP_VANILLAKEY.
Windowclass itself does not need vanilla key IDCMP.
WMHI_NEWSIZE returns some extra information in the low word:
if WMF_ZOOMED is set, the window is now in zoomed state. If
WMF_ZIPWINDOW is set, this resize was caused by either a
click of the zoom gadget or a call to ZipWindow().
WMHI_CHANGEWINDOW is returned when the window is moved. For
resizing of the window, listen to WMHI_NEWSIZE. By setting
WA_NotifyDepth, this event will also be returned for depth
arranging. The lower word contains CWCODE_DEPTH in this case.
WMHI_CLASSMASK masks the lower word of the result code out,
while WMHI_GADGETMASK and WMHI_MENUMASK mask out the high word,
leaving only the ID part of the result value.
A generic application side of WM_HANDLEINPUT looks like this:
GetAttr( WINDOW_SigMask, winobj, &wsig );
mask = Wait(wsig); /* maybe other signals */
if (mask & wsig)
while ((result = DoMethod( winobj, WM_HANDLEINPUT, &code ))
switch (result & WMHI_CLASSMASK)
close = TRUE;
switch (result & WMHI_GADGETMASK)
/* handle the gadgets here */
/* handle whatever other events you want here */
DisposeObject( winobj ); /* destroy the window */
If you have set up the window to use a shared message port, you
can simply call this method on each of the windows:
if (mask & wsig)
code -- A pointer to a WORD that should be set to contain the
Code value from the IntuiMessage.
Windowclass will automatically respond with an appropriate
action to many input events. When it does not know what to do
with an event, it will return with a value as descibed above.