THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/06/2005 at 12:22, xxxxxxxx wrote:
For mouse moves, use InputEvent(). GetInputState() is used for event polling. So, if you need to continuously track the mouse while redrawing, then use GetInputState() in a loop (as shown above) and call Redraw() within to refresh any graphics affected by this process.
InputEvent() handles mouse and keyboard input.
Now, my question is how you set up your UserArea. For instance, I don't think they work well from a dialog resource. It is best to derive your own class from GeUserArea (like my iSUserArea class above). I would need to see the code that you use to make the UserArea and the derived class to see why you are not getting input events. To really take control of the GeUserArea methods, you need to derive a class in order to override the default methods.
When the UserArea 'has focus' (when the cursor is in the UserArea), input events should arrive to the UserArea first. Any that are not handled there are sent to the dialog and then to Cinema 4D.
In your Dialog's CreateLayout(), these two lines should exist to realize the UserArea. 'IS_ISUSERAREA' is an id assigned to this dialog gadget (just like any other). 'isUserArea' is an instance of the derived class.
AddUserArea(IS_ISUSERAREA, BFH_SCALEFIT|BFV_SCALEFIT);
AttachUserArea(isUserArea, IS_ISUSERAREA, 0);
If your UserArea can be resized, then you must have this method to invoke redraws:
// GeUserArea.Sized
void iSUserArea::Sized(LONG w, LONG h)
{
Redraw();
}
A skeleton for the derived class:
// CLASS: MyUserArea
// -- for GeUserArea
class MyUserArea : public GeUserArea
{
private:
// - Events
Bool HandleMouseEvents(const BaseContainer& msg);
public:
MyUserArea();
~MyUserArea();
// - Functions to overload
Bool Init(void);
void Sized(LONG w, LONG h);
void Draw(LONG x1, LONG y1, LONG x2, LONG y2);
Bool InputEvent(const BaseContainer& msg);
};
Once the UserArea is attached to the dialog (and the dialog opened), InputEvent() automatically receives events relevant to the UserArea.