DG Kernel Documentation


Skip Navigation Links. Skip Navigation LinksHome Page > DG Kernel Components > Properies, Methods, Events > Events

Events of DG Kernel Control

MouseDown
MouseMove
MouseUp
ClientDraw
CurrentObjectChanged
Extended Mouse Events
KernelCADEvent Event
 
See also: Properties, Methods

Events:


void OnMouseDownKernelCAD(short Button, short Shift, long x, long y)     

Parameters  

Button - [in] 1 if left button pressed, 2 - if right mouse button pressed. Shift - [in] equals to 1 if Shift key is down and 0 otherwise. x, y - [in] - window coordinates of the mouse pointer. 

Remarks

The name of the handler for the event can be selected during implementation. OnMouseDownKernelCAD method is called when the user clicks  in the control display area using mouse buttons.

Notice: This event is not raised in the Dual Mode. Use MouseEx in this mode instead


void OnMouseMoveKernelCAD(short Button, short Shift, long x, long y)     

Parameters  

Button - [in] 1 if left button pressed, 2 - if right mouse button pressed. Shift - [in] equals to 1 if Shift key is down and 0 otherwise. x,y - [in] - window coordinates of the mouse pointer. 

Remarks

The name of the handler for the event can be selected during implementation. OnMouseMoveKernelCAD method is called when the user moves the mouse in the control display area.

Notice: This event is not raised in the Dual Mode. Use MouseEx in this mode instead


void OnMouseUpKernelCAD(short Button, short Shift, long x, long y)     

Parameters  

Button - [in] 1 if left button pressed, 2 - if right mouse button pressed. Shift - [in] equals to 1 if Shift key is down and 0 otherwise. x,y - [in] - window coordinates of the mouse pointer. 

Remarks

The name of the handler for the event can be selected during implementation. OnMouseDownKernelCAD method is called when user releases a mouse button while the pointer is positioned over the control display.


void OnClientDraw()    

Remarks

ClientDraw event is raised per rendering frame when the controls view needs to be repainted and after the rest of the model has been drawn.

Starting from v6.0 using IDraw interface inside OnClientDraw() has been deprecated and should be avoided. It is recommended to construct the required object as an entity, perhaps transient one,  and control its properties outside of this event. IDraw_DG queried from IModel_DG is useful to move code out of the handler with minimal changes. Compare implementation of Metrics sample in v5.2 and v6.0 to see an example.

Important: As client drawing involves some performance cost this event is not raised by default. To enable or disable it RequestClientDraw method has to be called.
void CurrentObjectChanged(VARIANT entity)   

Remarks

CurrentObjectChanged event is raised in Modify mode when the user selects a different object as current. punkVal member of entity  is a reference to IEntity_DG interface (can be safely cast to IEntity_DG type) of the newly selected object.

When the passed reference is NULL it means that user clicked outside any objects in the components view.

There are two context properties which modify behaviour related to this event. See more at Selection via the current object


void MouseEx(long eventType, long xMouse, long yMouse, long data)   

Parameters  

eventType [in] - Type of the event 

xMouse, yMouse [in] - window coordinates of the mouse pointer. The coordinates are relative to the top left corner of the window of the control. 

data[in] -Currently unused. Reserved for different types of events to be added in future releases

Remarks

The MouseEx event is used for detection of mouse behaviour slightly more complex than standard Mouse Up/Down/Move events. The actual type of event is described by the eventType parameter. Valid values of  eventType are enumerated by EDIEvent. In this release only eEventMouseHover, eEventMouseRButtonDown, eEventMouseRButtonMove and eEventMouseRButtonUp are passed trough via this event. Consider disabling conext menu for the right hand mouse button actions

The MouseHover event type occurs when the mouse pointer has stopped in a small area for about half a second after some movement . This is similar to behaviour detected for displaying tool tips in Windows User Interface.

Note: To receive notification about one of MouseEx events it has to be enabled with a call to RequestEvent with the same eventType value.


void KernelCADEvent( long eventType, const VARIANT& param0, VARIANT* param1 ) 

Parameters

eventType [in] - Type of the event. Valid values are enumerated in EDIEvent

param0 [in] - Parameter of the event. Meaning depends on eventType and is documented in each particular case

param1 [in,out] - Parameter of the event. Meaning depends on eventType and is documented in each particular case

Remarks

Meaning of param0 and param1 depends on the eventType. Most often the KernelCADEvent event is used to notify the application that the user selected a context menu item. eventType in this case coincides with EDIEvent.eEventUICommand. See more details in Context Menu topic