// THCustomMenu.pkg Use cCJCommandBarSystem.pkg Register_Procedure Activate_oToolsMenuView Register_Procedure Activate_oSourceMenuView Register_Procedure Activate_oDatabaseMenuView Class cCJCustomMenuItem is a cCJMenuItem Procedure Construct_Object Forward Send Construct_Object Property String psCommand "" End_Procedure Procedure OnExecute Variant vCommandBarControl Handle hoClient Get Client_Id to hoClient Send LaunchCustomUtility to hoClient (psCommand(Self)) End_Procedure End_Class Class cCustomMenuCustomizeItem is a cCJMenuItem Procedure Construct_Object Forward Send Construct_Object Property Integer piCustomizeMessage 0 Set pbAddToDesignerMenu to True Set pbControlBeginGroup to True Set psCaption to (_T("Customize Menu...", 252)) Set psToolTip to (_T("Customize Menu", 253)) Set psDescription to (_T("Customize user defined menu items", 254)) Set psShortcut to "" End_Procedure Procedure OnExecute Variant vCommandBarControl Handle hoClient Integer iMessage Get piCustomizeMessage to iMessage If iMessage Begin Get Client_Id to hoClient Send iMessage of hoClient End End_Procedure End_Class Class cCJCustomMenu is a cCJMenuItem Procedure Construct_Object Forward Send Construct_Object Property Handle[] phCustomItems Set peControlType to xtpControlPopup End_Procedure Procedure Clear_CustomItems Handle[] hArrayOfWindows Integer iC iWindows Get phCustomItems to hArrayOfWindows Move (SizeOfArray(hArrayOfWindows)) to iWindows For iC from 0 to (iWindows-1) If (hArrayOfWindows[iC]) ; Send Destroy of hArrayOfWindows[iC] // assume this removes all menu items of this action Loop End_Procedure Procedure Create_CustomItems Handle hCommandBarControls String sItemType Integer iCustomizeMessage String sUtility sCommand sType sDesc Integer iC iCount iItem iUtility Handle[] hArrayOfWindows Variant vItem // Send Clear_CustomItems // Move 0 to iUtility Get psCustomMenuUtilities.Count of ghoEditorProperties to iCount For iItem from 0 to (iCount-1) Get psCustomMenuUtilities of ghoEditorProperties item iITem to sUtility Get psCustomMenuUtilities.psUtilityCommand of ghoEditorProperties item iITem to sCommand Get psCustomMenuUtilities.psUtilityType of ghoEditorProperties item iITem to sType If (sType=sItemType) Begin Get Create U_cCJCustomMenuItem to hArrayOfWindows[iUtility] If (iUtility=0) Set pbControlBeginGroup of hArrayOfWindows[iUtility] to True Set psCommand of hArrayOfWindows[iUtility] to sCommand Set psCaption of hArrayOfWindows[iUtility] to sUtility #IFDEF TH_TRANSLATION Move (Replace("%1", gILanguage[255], sUtility)) to sDesc #ELSE Move ("Run" * sUtility * ".") to sDesc #ENDIF Set psDescription of hArrayOfWindows[iUtility] to sDesc Get AddDynamicControl of hArrayOfWindows[iUtility] hCommandBarControls to vItem Increment iUtility End Loop // Customize option Get Create U_cCustomMenuCustomizeItem to hArrayOfWindows[iUtility] Set piCustomizeMessage of hArrayOfWindows[iUtility] to iCustomizeMessage Get AddDynamicControl of hArrayOfWindows[iUtility] hCommandBarControls to vItem // Set phCustomItems to hArrayOfWindows // End_Procedure End_Class