Welcome
Expand Getting StartedGetting Started
Expand SOLIDWORKS API HelpSOLIDWORKS API Help
Collapse SOLIDWORKS Electrical API HelpSOLIDWORKS Electrical API Help
Expand Getting StartedGetting Started
Expand Add a Custom CommandAdd a Custom Command
Expand Add an Add-inAdd an Add-in
Expand Release NotesRelease Notes
Expand SampleSample
Collapse ClassesClasses
Expand Class ListClass List
Class Index
Collapse Class HierarchyClass Hierarchy
Collapse IDispatchIDispatch
IEwAPIX
IEwAddIn
IEwAddinInternalX
IEwApplicationSettingsX
IEwApplicationX
IEwArchiveEnvironmentX
IEwCableCoreX
IEwCableReferenceManagerX
IEwCaptionBarControlX
IEwCaptionBarX
IEwClassificationManagerX
IEwCommandContextX
IEwCommandManagerX
IEwCommandX
IEwDialogAlignPartsParametersSelectorX
IEwDialogLocationSelectorX
IEwDialogMacroSelectorX
IEwDialogManufacturerPartOrderingX
IEwDialogManufacturerPartSelectorX
IEwDialogProgressX
IEwDialogProjectManagerX
IEwDialogResumeX
IEwDialogSummaryX
IEwDialogTaskX
IEwDockingPaneManagerX
IEwDockingPaneX
IEwDocumentManagerX
IEwDocumentX
IEwEnvironmentX
IEwLibraryManagerX
IEwLockStringX
IEwManagerDialogX
IEwManufacturerPartCircuitX
IEwManufacturerPartManagerX
IEwManufacturerPartTerminalX
IEwMenuItemX
IEwMenuManagerX
IEwMenuX
IEwNotificationDialogX
Expand IEwObjectDispatchXIEwObjectDispatchX
IEwPointX
IEwProjectAutomaticArrowsX
IEwProjectBookManagerX
IEwProjectCableManagerX
IEwProjectComponentManagerX
IEwProjectEntity3DManagerX
IEwProjectExcelAutomationX
IEwProjectExportDWGFilesX
IEwProjectExportPDFX
IEwProjectExportPDMX
IEwProjectExportReportX
IEwProjectFileConfigurationManagerX
IEwProjectFileConfigurationX
IEwProjectFileManagerX
IEwProjectFolderManagerX
IEwProjectFunctionManagerX
IEwProjectGenerateTSDrawingX
IEwProjectHarnessManagerX
IEwProjectInputOutputManagerX
IEwProjectLocationManagerX
IEwProjectManagerX
IEwProjectManufacturerPartCircuitX
IEwProjectManufacturerPartManagerX
IEwProjectManufacturerPartTerminalX
IEwProjectMultilingualTextFontX
IEwProjectMultilingualTextManagerX
IEwProjectNumberDocumentsX
IEwProjectNumberMarksX
IEwProjectNumberWiresX
IEwProjectOptimizeWireOrderX
IEwProjectPrintConfigManagerX
IEwProjectReportManagerX
IEwProjectSnapshotManagerX
IEwProjectSnapshotX
IEwProjectSymbolManagerX
IEwProjectUpdateReplaceDataX
IEwProjectWireManagerX
IEwProjectWireStyleManagerX
IEwProjectX
IEwResumeRowX
IEwRibbonComboBoxControlX
IEwRibbonControlX
IEwRibbonGroupX
IEwRibbonQuickAccessControlX
IEwRibbonTabX
IEwRibbonX
IEwRightsManagerX
IEwSaveDWGImageX
IEwSelectorDialogX
IEwSymbolCircuitX
IEwSymbolFiltersX
IEwSymbolManagerX
IEwSymbolPointX
IEwTerminalTypeManagerX
IEwTitleBlockManagerX
IEwWireTerminationTypeManagerX
IEwXLSBookX
IEwXLSSheetX
Expand IInteropFactoryXIInteropFactoryX
Expand Class MembersClass Members
Expand SOLIDWORKS PDM Professional API HelpSOLIDWORKS PDM Professional API Help
Expand PDM Pro API Web ServicePDM Pro API Web Service
Expand FeatureWorks API HelpFeatureWorks API Help
Expand SOLIDWORKS Costing API HelpSOLIDWORKS Costing API Help
Expand SOLIDWORKS Document Manager API HelpSOLIDWORKS Document Manager API Help
Expand SOLIDWORKS Inspection API HelpSOLIDWORKS Inspection API Help
Expand SOLIDWORKS Routing API HelpSOLIDWORKS Routing API Help
Expand SOLIDWORKS Simulation API HelpSOLIDWORKS Simulation API Help
Expand SOLIDWORKS Sustainability API HelpSOLIDWORKS Sustainability API Help
Expand SOLIDWORKS Toolbox API HelpSOLIDWORKS Toolbox API Help
Expand SOLIDWORKS Utilities API HelpSOLIDWORKS Utilities API Help
Expand eDrawings API HelpeDrawings API Help
Expand DraftSight API HelpDraftSight API Help
Expand Lisp Programming BasicsLisp Programming Basics
Expand Lisp Functions OverviewLisp Functions Overview
Expand Lisp Functions ReferenceLisp Functions Reference
Expand Visual Lisp Compatible FunctionsVisual Lisp Compatible Functions
Hide Table of Contents
SOLIDWORKS Electrical API 2024.0.0
Electrical API
IEwMenuItemX Interface Reference

Use this interface to manage an EwMenuItemX object. More...

Inheritance diagram for IEwMenuItemX:
Inheritance graph

Public Member Functions

BSTR getCaption (EwErrorCode *errorCode)
 Return the caption of this menu item. More...
 
EwErrorCode setCaption (BSTR strCaption)
 Set a new caption for this menu item. More...
 
BSTR getToolTip (EwErrorCode *errorCode)
 Return the ToolTip of this menu item. More...
 
EwErrorCode setToolTip (BSTR strToolTip)
 Set a new ToolTip for this menu item. More...
 
BSTR getDescription (EwErrorCode *errorCode)
 Return the description of this menu item. More...
 
EwErrorCode setDescription (BSTR strDescription)
 Set a description for this menu item. More...
 
VARIANT_BOOL isEnabled (EwErrorCode *errorCode)
 Determine if the menu item is enabled. More...
 
EwErrorCode setEnabled (VARIANT_BOOL bEnabled)
 Set whether the menu item is enabled. More...
 
VARIANT_BOOL isSeparator (EwErrorCode *errorCode)
 Determine if the menu item is a separator. More...
 
EwErrorCode setSeparator (VARIANT_BOOL bIsSeparator)
 Set menu item as a separator. More...
 
BSTR getShortcut (EwErrorCode *errorCode)
 Get the menu item's shortcut. More...
 
EwErrorCode setShortcut (BSTR strShortcutText)
 Set the shortcut string of the menu item. More...
 
EwErrorCode setIconFromImage (BSTR strImageFilePath, COLORREF crMask)
 Add an icon from file. More...
 
EwMenuStyle getStyle (EwErrorCode *errorCode)
 Get an IEwMenuStyle enum value that could be: More...
 
EwErrorCode setStyle (EwMenuStyle eMenuStyle)
 Set an IEwMenuStyle enum value that could be: More...
 
int getID ()
 Get the ID of menu item. More...
 
BSTR getCommand (EwErrorCode *errorCode)
 Return the text of parameter strCommand used when adding a menu item. More...
 
EwErrorCode setCommand (BSTR strCommand)
 Set the name of the command associated with this menu item. More...
 
VARIANT_BOOL getCheck (EwErrorCode *errorCode)
 Determine if the menu item is checked. More...
 
EwErrorCode setCheck (VARIANT_BOOL bCheck)
 Check or uncheck the menu item. More...
 
LONG getIndex (EwErrorCode *errorCode)
 Return the index of the menu item. More...
 
VARIANT_BOOL hasSubMenu (EwErrorCode *errorCode)
 Determine if the menu item has sub menu. More...
 
IEwMenuItemX addMenuItem (EwMenuStyle eMenuStyle, BSTR strCommand, EwErrorCode *errorCode)
 Add a new sub menu item at the end of the menu. More...
 
IEwMenuItemX addMenuItemAt (int iIndex, EwMenuStyle eMenuStyle, BSTR strCommand, EwErrorCode *errorCode)
 Add a new sub menu item at a specified position in the sub menu. More...
 
IEwMenuItemX getMenuItemAt (int iIndex, EwErrorCode *errorCode)
 Return the specified sub menu item of this menu item. More...
 
UINT getMenuID ()
 Return the ID of the context menu. More...
 
VARIANT_BOOL isVisible (EwErrorCode *errorCode)
 Determine if the menu item is visible. More...
 
EwErrorCode setVisible (VARIANT_BOOL bShow)
 Set whether the menu item is visible. More...
 

Detailed Description

Use this interface to manage an EwMenuItemX object.

Since
2022 SP2

Member Function Documentation

◆ addMenuItem()

IEwMenuItemX IEwMenuItemX::addMenuItem ( EwMenuStyle  eMenuStyle,
BSTR  strCommand,
EwErrorCode errorCode 
)

Add a new sub menu item at the end of the menu.

Parameters
[in]eMenuStyleEwMenuStyle enum type
[in]strCommandthe name of a command to launch. Can be blank.
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_BAD_INPUTS if eMenuStyle is not a good menu style or parent menu item cannot have a sub menu
  • EW_NO_ERROR if no error detected
Returns
an IEwMenuItemX added to the menu.

◆ addMenuItemAt()

IEwMenuItemX IEwMenuItemX::addMenuItemAt ( int  iIndex,
EwMenuStyle  eMenuStyle,
BSTR  strCommand,
EwErrorCode errorCode 
)

Add a new sub menu item at a specified position in the sub menu.

if position is negative or higher than the number of menu items in menu, then the menu item will be added at the end

Parameters
[in]iIndexposition where menu item must be inserted in menu
[in]eMenuStyleEwMenuStyle enum type
[in]strCommandthe name of a command to launch. Can be blank.
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_BAD_INPUTS if eMenuStyle is not a good menu style or parent menu item does not have a sub menu
  • EW_NO_ERROR if no error detected
Returns
an IEwMenuItemX added to the menu.

◆ getCaption()

BSTR IEwMenuItemX::getCaption ( EwErrorCode errorCode)

Return the caption of this menu item.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
the caption of this menu item.

◆ getCheck()

VARIANT_BOOL IEwMenuItemX::getCheck ( EwErrorCode errorCode)

Determine if the menu item is checked.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
TRUE if the menu item is checked, FALSE otherwise.

◆ getCommand()

BSTR IEwMenuItemX::getCommand ( EwErrorCode errorCode)

Return the text of parameter strCommand used when adding a menu item.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
the text of parameter strCommand used when adding a menu item.

◆ getDescription()

BSTR IEwMenuItemX::getDescription ( EwErrorCode errorCode)

Return the description of this menu item.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
the description of this menu item.

◆ getID()

int IEwMenuItemX::getID ( )

Get the ID of menu item.

Returns
the ID of the menu item.

◆ getIndex()

LONG IEwMenuItemX::getIndex ( EwErrorCode errorCode)

Return the index of the menu item.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
an integer that is the index of the current menu item.

◆ getMenuID()

UINT IEwMenuItemX::getMenuID ( )

Return the ID of the context menu.

Returns
the ID of the context menu.

◆ getMenuItemAt()

IEwMenuItemX IEwMenuItemX::getMenuItemAt ( int  iIndex,
EwErrorCode errorCode 
)

Return the specified sub menu item of this menu item.

Parameters
[in]iIndexPosition of the sub menu item.
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_BAD_INPUTS if the index is negative or greater than the number of sub menu items or parent menu item does not have a sub menu
  • EW_OBJECT_NOT_FOUND if the object not found, then return null
  • EW_NO_ERROR if no error detected
Returns
An IEwMenuItemX specified.

◆ getShortcut()

BSTR IEwMenuItemX::getShortcut ( EwErrorCode errorCode)

Get the menu item's shortcut.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
the shortcut of the menu item.

◆ getStyle()

EwMenuStyle IEwMenuItemX::getStyle ( EwErrorCode errorCode)

Get an IEwMenuStyle enum value that could be:

  • kNone, this is default
  • k3Dot, to add three dots to the end of the text.
    Parameters
    [out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
    Returns
    the EwMenuStyle enum menu item's style.

◆ getToolTip()

BSTR IEwMenuItemX::getToolTip ( EwErrorCode errorCode)

Return the ToolTip of this menu item.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
the ToolTip of this menu item.

◆ hasSubMenu()

VARIANT_BOOL IEwMenuItemX::hasSubMenu ( EwErrorCode errorCode)

Determine if the menu item has sub menu.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
TRUE if the menu item has sub menu, FALSE otherwise.

◆ isEnabled()

VARIANT_BOOL IEwMenuItemX::isEnabled ( EwErrorCode errorCode)

Determine if the menu item is enabled.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
TRUE if the menu item is enabled, FALSE otherwise.

◆ isSeparator()

VARIANT_BOOL IEwMenuItemX::isSeparator ( EwErrorCode errorCode)

Determine if the menu item is a separator.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
TRUE if the menu item starts a separator; otherwise FALSE.

◆ isVisible()

VARIANT_BOOL IEwMenuItemX::isVisible ( EwErrorCode errorCode)

Determine if the menu item is visible.

Parameters
[out]errorCodeEwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected
Returns
TRUE if the menu item is visible, FALSE otherwise.

◆ setCaption()

EwErrorCode IEwMenuItemX::setCaption ( BSTR  strCaption)

Set a new caption for this menu item.

Parameters
[in]strCaptionthe new caption to display.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected

◆ setCheck()

EwErrorCode IEwMenuItemX::setCheck ( VARIANT_BOOL  bCheck)

Check or uncheck the menu item.

Parameters
[in]bCheckTRUE to check the menu item, FALSE to uncheck the menu item.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected

◆ setCommand()

EwErrorCode IEwMenuItemX::setCommand ( BSTR  strCommand)

Set the name of the command associated with this menu item.

Parameters
[in]strCommandthe new parameter command to execute.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected

◆ setDescription()

EwErrorCode IEwMenuItemX::setDescription ( BSTR  strDescription)

Set a description for this menu item.

Parameters
[in]strDescriptionthe new description to display.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected

◆ setEnabled()

EwErrorCode IEwMenuItemX::setEnabled ( VARIANT_BOOL  bEnabled)

Set whether the menu item is enabled.

Parameters
[in]bEnabledTRUE to enable the menu item, FALSE to disable the menu item. If FALSE, the menu item will appear "grayed out" and the user can not access the menu item.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected

◆ setIconFromImage()

EwErrorCode IEwMenuItemX::setIconFromImage ( BSTR  strImageFilePath,
COLORREF  crMask 
)

Add an icon from file.

Image to menu item should be .ico, .bmp, .png file.

Parameters
[in]strImageFilePaththe full Image file path.
[in]crMaskColor mask for BMP and PNG images. Blanck (0x00FFFFFF) by default
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_BAD_INPUTS if the file path doesn't exist or if not a .ico, .bmp, .png file.
  • EW_NO_ERROR if no error detected

◆ setSeparator()

EwErrorCode IEwMenuItemX::setSeparator ( VARIANT_BOOL  bIsSeparator)

Set menu item as a separator.

Parameters
[in]bIsSeparatorTRUE if the menu item starts a separator; otherwise FALSE.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected

◆ setShortcut()

EwErrorCode IEwMenuItemX::setShortcut ( BSTR  strShortcutText)

Set the shortcut string of the menu item.

Parameters
[in]strShortcutTextShortcut to be set.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected

◆ setStyle()

EwErrorCode IEwMenuItemX::setStyle ( EwMenuStyle  eMenuStyle)

Set an IEwMenuStyle enum value that could be:

  • kNone, this is default
  • k3Dot, to add three dots to the end of the text.
    Parameters
    [in]eMenuStyleEwMenuStyle The style to be set. Can be any of the values listed in the EwMenuStyle enum.
    Returns
    EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_BAD_INPUTS if eMenuStyle is not a good menu style
  • EW_NO_ERROR if no error detected

◆ setToolTip()

EwErrorCode IEwMenuItemX::setToolTip ( BSTR  strToolTip)

Set a new ToolTip for this menu item.

Parameters
[in]strToolTipthe new ToolTip to display.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected

◆ setVisible()

EwErrorCode IEwMenuItemX::setVisible ( VARIANT_BOOL  bShow)

Set whether the menu item is visible.

Parameters
[in]bShowTRUE to show the menu item, FALSE to hide the menu item.
Returns
EwErrorCode enum type, can be:
  • EW_UNDEFINED_ERROR if the reason for error is unknown
  • EW_INVALID_OBJECT if object is not initialized
  • EW_NO_ERROR if no error detected


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   SOLIDWORKS Electrical API: IEwMenuItemX Interface Reference
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:




x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2024 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.