Class CUIFrameMsgHandler

3DS Max Plug-In SDK

Class CUIFrameMsgHandler

See Also: Class ICUIFrame, Class CUIFrameMgr, Class CUIPosData, Class ICustomControl.

class CUIFrameMsgHandler

Description:

This class is available in release 3.0 and later only.

This class provides a way for messages received by a CUIFrame to be processed in a context-specific fashion.

Since the CUI Frame is just a window, it needs a window proc. There is one built into the CUI system, but it may need additional information that is specific to how the frame is being used. For example, in 3ds max the command panel can't be resized horizontally and the default window proc can't manage this.

For such situations, the application must install a CUIFrameMsgHandler object. You establish that this is the handler for the frame using the method ICUIFrame::InstallMsgHandler(CUIFrameMsgHandler *msgHandler).

These message handlers have one significant class method: ProcessMessage(). If ProcessMessage() returns TRUE, then the CUI system assumes that the message is completely handled. If it returns FALSE, then the standard CUI processing takes place. (Note that the message handler may still return FALSE, even if it does some processing...).

There is a special message (CUI_POSDATA_MSG) that is sent by the CUI system to the message handler to get information on window size constraints, etc. An example of processing this message is shown below. In this case editPosData is a static instance of CUIPosData. That object has GetWidth() and GetHeight() methods which return the proper width and height size for various orientations. See Class CUIPosData for details.

 case CUI_POSDATA_MSG: {

  CUIPosData **cpd = (CUIPosData **)lParam;

  cpd[0] = &editPosData;

  }

  return TRUE;

Methods:

public:

Prototype:

virtual int ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam);

Remarks:

This method is called to handle any processing not done by the default CUI window proc.

This method should return TRUE if the message is handled and FALSE if not. If FALSE is returned (or no handler is defined), then the CUIFrame simply passes WM_COMMAND messages on to its parent. Window position messages are passed from the CUIFrame to the HWND of the 'content' (either a toolbar or menu). Other messages are passed on to the default window proc.

Note: Developers should not return TRUE for the entire ProcessMessage routine, since if this is done, the right-click menu functionality will not work (e.g. docking, floating, move-to-shelf, customize, etc.).

Also Note: Developers should not use IDs that may conflict with the ones used by the default processing provide by MAX. The IDs which should be avoided are in the 40000, 47000, and 61000 range. For instance the following IDs are all invalid since they are in those ranges: 40005, 47900, 61102. The reason this is a problem is that if you return FALSE after processing a particular ID, then 3ds max will go ahead and process that ID also. And if the ID matches one already in MAX, an unintended function may get called.

Parameters:

UINT message

Specifies the message.

WPARAM wParam

Specifies additional message information. The contents of this parameter depend on the value of the message parameter.

LPARAM lParam

Specifies additional message information. The contents of this parameter depend on the value of the message parameter.

Default Implementation:

{ return FALSE; }