DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Expand ModelsModels
Collapse DG Kernel ControlsDG Kernel Controls
Expand API ReferenceAPI Reference
Expand ViewsViews
Expand Samples and TutorialsSamples and Tutorials
Expand GraphicsGraphics
Expand Math ObjectsMath Objects
Expand DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation LinksHome Page > DG Kernel Controls > Interactive Functionality > Context Menu Go to DGKC docs Search Documentation


Context Menu

By default DG Kernel components display context menu (right mouse button). The menu can be disabled (It will stop appearing) by setting the Context Menu property in the Component Context

Default structure of top level of the context menu, displayed on start of the application, is described by EMenuCommand_KC enumeration.

The menu can be modified at runtime. The menu items and submenus, including default ones, can be disabled/enabled, removed, added etc using IMenu_KC and IMenuItem_KC interfaces. IMenu_KC can be queried from IView_DG interface of the component.

When a menu item is selected by the user the component raises DG Kernel Event to notify the application. The application can either update its User Interface accordingly or block the command and execute a custom action  instead.

The eventType parameter of the DG Kernel Event in this case is EDIEvent.eEventUICommand.

Type of the param0 has to be detected at runtime. It passed out as a generic VARIANT type. For backward compatibility it is integer for top level items and has IMenuItem_KC type for items of submenus.

Use code similar to:

Dim typeParam0 As Type = e.param0.GetType()  \ If typeParam0.Equals(GetType(UInt32)) Then .. (VB .NET)

Type typeParam0 = e.param0.GetType(); if( typeParam0.Equals(GetType(UInt32) ) ....                     (C#)

if( param0.vt == VT_UINT )   ....            (C++)

to detect the type

For top level items param0 has integer type and contains integer 0-based index of the selected menu item. For items of submenus the index (along with other properties) can be obtained via IMenuItem_KC.GetIndex()

param1  has Boolean type, is false at the start of the handler and is considered as the return value, which indicates whether the component should proceed with execution of the command. If the event handler changes param1 to true the component does not execute the command. When the menu item has index greater than EMenuCommand_KC.eMenuCommandAbout the return value is not used by the component as there is no default action assigned to the item. See Light Sample for an example.

param1  Has has any effect only for default items at positions added by the component at the start. It is ignored for new items added at runtime using methods of IMenu_KC

See also: Light Sample