KernelCAD Documentation

DInsight Home
Skip Navigation Links.
Start page
Quick Start
Installation
Overview of the software
What is new
Collapse KernelCAD ModelsKernelCAD Models
Collapse KernelCAD ComponentsKernelCAD Components
KernelCAD Control
KernelCAD .NET Control
Methods and Properties
Menu
Model Explorer
Birds Eye View
Programming
Direct User Access
Direct Operations
Interface Queries
Printing Support
Data Types
Modes of KernelCAD Control
DIObjectGenerator class
Properties
FlatObjectArray Poperty
Context
64 bit development
Dual Mode
Initialisation Context
Overlay Editor
Memory Management
Input validation
Collapse Advanced functionalityAdvanced functionality
Collapse InterfacesInterfaces
Alphabetical list
I3DGrid
I3DBugger
I3Dpt
IAxiBase
IAxis
IBoolSection
IBoolSectionEx
IBoundary
IColor
IConstraint
IData
IDiffSurface_KC
IDIFont
IDraw
IDrawUtil
IDraw2
IElem
IElement
IKCLine
ILightSource
ILocation
ILocationEx
IMaterial
IMetrics
IMetrics2
IModel
IModel2
IModelEx
IPatch
IKCPathCollisionDetector
IProfiles
IPropertyArray
IPropertyArray2
IStdShape
IStrip
ISurface
IText
ITexture
ITransform
IUnknown
Collapse Open Cascade TechnologyOpen Cascade Technology
Collapse DataData
Collapse MovementMovement
Collapse FramesFrames
Collapse Oriented ObjectsOriented Objects
Collapse SectionsSections
Collapse GeneralGeneral
Collapse Topological InterfacesTopological Interfaces
Collapse Viewing InterfacesViewing Interfaces
Collapse Lines And CurvesLines And Curves
Collapse Symmetry InterfacesSymmetry Interfaces
Collapse Clipping plane interfacesClipping plane interfaces
Collapse AlgorithmsAlgorithms
Collapse 2D Geometry2D Geometry
Collapse Programming Samples and TutorialsProgramming Samples and Tutorials
Collapse OverviewOverview
Collapse DeploymentDeployment
Collapse .NET Samples.NET Samples
Collapse C++ SamplesC++ Samples
Collapse Visual Basic SamplesVisual Basic Samples
Collapse Delphi SamplesDelphi Samples
Collapse 3D Debugger3D Debugger
Collapse DeploymentDeployment
Licensing
Model Viewer
Open C++ Source
Technical Support
Skip Navigation LinksHome Page > KernelCAD Components > Menu
Context Menu

Context Menu

By default KernelCAD 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 IIView interface of the component.

When a menu item is selected by the user the component raises KernelCAD 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 KernelCAD 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