{"id":115,"date":"2009-08-10T08:31:00","date_gmt":"2009-08-10T08:31:00","guid":{"rendered":"http:\/\/www.greytrix.com\/blogs\/sagemas\/?p=115"},"modified":"2025-04-23T06:24:57","modified_gmt":"2025-04-23T06:24:57","slug":"adding-custom-context-sensitive-menu","status":"publish","type":"post","link":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/","title":{"rendered":"Adding Custom Context Sensitive Menu"},"content":{"rendered":"\n<p>In the standard MAS 500 screens, there are Context sensitive menus in the transaction grids where user clicks the right button of the mouse and a popup is prompted to perform different functions.<\/p>\n\n\n\n<p>User selects the options to perform different functions like \u2018Add line\u2019 to add a new line, \u2018Insert Line\u2019 to insert a line in the grid, etc.<\/p>\n\n\n\n<p>Adding custom options in the context-sensitive menu will be useful to provide new menus like \u201cCopy Line\u201d, \u201cImport\/Export\u201d, etc and writing logic for that options to perform the desired functions. Please refer the below screenshot.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s1600-h\/Copy+Line.JPG\"><img decoding=\"async\" src=\"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG\" alt=\"Estimate Entry\" title=\"Estimate Entry\"\/><\/a><\/figure><\/div>\n\n\n<p>Below we have provided instructions and a sample code to add a custom menu in the standard context-sensitive menus:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>User will need to add the code in the procedure \u2018BindContextMenu\u2019 which is called from Form Load event.<\/li>\n\n\n\n<li>Call a function \u2018CMAppendContextMenu\u2019 which will be called when we write the append code in the BindContextMenu procedure.<\/li>\n\n\n\n<li>After writing the code in the CMAppendContextMenu procedure the additional custom menu will be displayed in the menu list.<\/li>\n\n\n\n<li>To execute the logic which is to be called from the custom menu selected is to be written in a function \u2018CMMenuSelected\u2019.<\/li>\n<\/ul>\n\n\n\n<p>Example:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><b>Adding Code in the Procedure BindContextMenu<\/b><\/li>\n<\/ol>\n\n\n\n<p>.Bind \u201c*Append\u201d, Cstr (grdMain.hwnd)<br>Using \u201c*Append\u201d the function CMAppendContextMenu will be called when user clicks the right button of the mouse.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><b>Writing code in the function CMAppendContextMenu<\/b><\/li>\n<\/ol>\n\n\n\n<p>If the above function is already present in the source code then you need to add the additional code in the above function.<\/p>\n\n\n\n<p>If the function is not present in the source code then you have to write the function as follows:<\/p>\n\n\n\n<p>Public Function CMAppendContextMenu(Ctl as Control, hmenu as Long) as Boolean<\/p>\n\n\n\n<p>Ctl: The control that received the right mouse button down message.<br>Hmenu: A Long type. The menu handles of the popup menu.<br>Return Value A Boolean. Returns true if an item was appended to the menu. Returns False if nothing was appended to the menu.<\/p>\n\n\n\n<p>Dim sCopy As String<br>sCopy = &#8220;&amp;Copy&#8221;<\/p>\n\n\n\n<p>Select Case True<br>Case ctl Is grdMain<\/p>\n\n\n\n<p>lRow = glGridGetActiveRow (grdMain)<\/p>\n\n\n\n<p>If lRow &gt; 1 Then<br>AppendMenu hmenu, MF_ENABLED, 30003, sCopy<br>CMAppendContextMenu = True<br>End If<br>End Select<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><b>Writing code in the function CMMenuSelected<\/b><\/li>\n<\/ol>\n\n\n\n<p>If the above function is already present in the source code then you need to add the additional code in the above function.<br>If the function is not present in the source code then you have to write the function as follows:<\/p>\n\n\n\n<p>Public Sub CMMenuSelected (ctl As Control, lTaskID As Long)<br>ctl: The control that received the right mouse button down message.<br>lTaskID: The Task ID of the selected task.<\/p>\n\n\n\n<p>The above function is called when the custom menu is selected. You have to write the logic which is to be performed when the custom menu is selected.<\/p>\n\n\n\n<p>Hope this helps.<\/p>\n\n\n\n<p>In case of any assistance feel free to contact us at&nbsp;<a href=\"mailto:sage@greytrix.com\">sage@greytrix.com<\/a>.<\/p>\n\n\n\n<p><strong>About Us<\/strong><br><a href=\"https:\/\/www.greytrix.com\/\">Greytrix<\/a>&nbsp;is a one stop solution provider for Sage ERP and Sage CRM needs. We provide complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.<\/p>\n\n\n\n<p>Greytrix&nbsp;has some unique solutions of&nbsp;<a href=\"https:\/\/www.greytrix.com\/product\/sage-crm\/gumu-sage-100-erp-integration\">Sage 100 integration with Sage CRM<\/a>,&nbsp;and&nbsp;<a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/gumu-100-salesforce-integration\">Salesforce.com<\/a>&nbsp;along with&nbsp;<a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/sage-50-us-sage-100-migration\">Sage 100 Migration from Sage 50 US<\/a>,&nbsp;<a href=\"https:\/\/www.greytrix.com\/product\/intacct-apps-and-products\/gumu-sage-intacct-sage-100-migration\">Sage Intacct<\/a>,&nbsp;<a href=\"https:\/\/www.greytrix.com\/product\/sage-100-erp\/quickbooks-sage-100-migration\">QuickBooks<\/a>, Sage Business Vision and Sage Business Works. We also offer best-in-class&nbsp;<a href=\"https:\/\/www.greytrix.com\/product\/erp-development\/sage-100-erp\">Sage 100 customization and development services&nbsp;<\/a>to Sage business partners, end users, and Sage PSG worldwide.<\/p>\n\n\n\n<p>For more details on Sage 100 Services, please contact us at&nbsp;<a href=\"mailto:sage@greytrix.com\">sage@greytrix.com<\/a>. We will be glad to assist you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the standard MAS 500 screens, there are Context sensitive menus in the transaction grids where user clicks the right button of the mouse and a popup is prompted to perform different functions. User selects the options to perform different functions like \u2018Add line\u2019 to add a new line, \u2018Insert Line\u2019 to insert a line\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[83,116,213,215],"tags":[],"class_list":["post-115","post","type-post","status-publish","format-standard","hentry","category-grid-handling","category-mas-500","category-tips","category-transactions"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom Context Sensitive Menu Addition<\/title>\n<meta name=\"description\" content=\"Discover how to use several features, such as &quot;Insert Line&quot; to insert a line into the grid, &quot;Add line&quot; to add a new line, etc.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom Context Sensitive Menu Addition\" \/>\n<meta property=\"og:description\" content=\"Discover how to use several features, such as &quot;Insert Line&quot; to insert a line into the grid, &quot;Add line&quot; to add a new line, etc.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/\" \/>\n<meta property=\"og:site_name\" content=\"GUMU\u2122 Integrations \u2013 Tips, Tricks and Components\" \/>\n<meta property=\"article:published_time\" content=\"2009-08-10T08:31:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-23T06:24:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG\" \/>\n<meta name=\"author\" content=\"greysagemas\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"greysagemas\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/\",\"name\":\"Custom Context Sensitive Menu Addition\",\"isPartOf\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG\",\"datePublished\":\"2009-08-10T08:31:00+00:00\",\"dateModified\":\"2025-04-23T06:24:57+00:00\",\"author\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/#\/schema\/person\/b57e6e3564a12ef62967850ae0416728\"},\"description\":\"Discover how to use several features, such as \\\"Insert Line\\\" to insert a line into the grid, \\\"Add line\\\" to add a new line, etc.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#primaryimage\",\"url\":\"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG\",\"contentUrl\":\"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Adding Custom Context Sensitive Menu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/#website\",\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/\",\"name\":\"GUMU\u2122 Integrations \u2013 Tips, Tricks and Components\",\"description\":\"Welcome to the GUMU\u2122 blog, your one-stop source to gain all the insights on seamless integration solutions for ERP and CRM systems. Developed by Greytrix, GUMU\u2122 is a powerful integration platform that bridges the gap between your business applications. Whether you\u2019re looking to integrate a CRM (Salesforce, Dynamics 365 CRM, and Sage CRM) or an ERP (Sage ERP, Acumatica) with each other or any other third-party application, GUMU\u2122 is a robust and reliable integrator tailored to your unique needs. Join us as we explore the abilities of GUMU\u2122 and learn how it transforms your integration experience. \",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/#\/schema\/person\/b57e6e3564a12ef62967850ae0416728\",\"name\":\"greysagemas\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g\",\"caption\":\"greysagemas\"},\"url\":\"https:\/\/www.greytrix.com\/blogs\/sagemas\/author\/greysagemas\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Custom Context Sensitive Menu Addition","description":"Discover how to use several features, such as \"Insert Line\" to insert a line into the grid, \"Add line\" to add a new line, etc.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/","og_locale":"en_US","og_type":"article","og_title":"Custom Context Sensitive Menu Addition","og_description":"Discover how to use several features, such as \"Insert Line\" to insert a line into the grid, \"Add line\" to add a new line, etc.","og_url":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/","og_site_name":"GUMU\u2122 Integrations \u2013 Tips, Tricks and Components","article_published_time":"2009-08-10T08:31:00+00:00","article_modified_time":"2025-04-23T06:24:57+00:00","og_image":[{"url":"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG","type":"","width":"","height":""}],"author":"greysagemas","twitter_card":"summary_large_image","twitter_misc":{"Written by":"greysagemas","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/","url":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/","name":"Custom Context Sensitive Menu Addition","isPartOf":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#primaryimage"},"image":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#primaryimage"},"thumbnailUrl":"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG","datePublished":"2009-08-10T08:31:00+00:00","dateModified":"2025-04-23T06:24:57+00:00","author":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/#\/schema\/person\/b57e6e3564a12ef62967850ae0416728"},"description":"Discover how to use several features, such as \"Insert Line\" to insert a line into the grid, \"Add line\" to add a new line, etc.","breadcrumb":{"@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#primaryimage","url":"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG","contentUrl":"https:\/\/3.bp.blogspot.com\/_A6_b0zkYeSY\/Sn_bEXA8doI\/AAAAAAAAAg0\/SsBKmuklb0w\/s320\/Copy+Line.JPG"},{"@type":"BreadcrumbList","@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/2009\/08\/10\/adding-custom-context-sensitive-menu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.greytrix.com\/blogs\/sagemas\/"},{"@type":"ListItem","position":2,"name":"Adding Custom Context Sensitive Menu"}]},{"@type":"WebSite","@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/#website","url":"https:\/\/www.greytrix.com\/blogs\/sagemas\/","name":"GUMU\u2122 Integrations \u2013 Tips, Tricks and Components","description":"Welcome to the GUMU\u2122 blog, your one-stop source to gain all the insights on seamless integration solutions for ERP and CRM systems. Developed by Greytrix, GUMU\u2122 is a powerful integration platform that bridges the gap between your business applications. Whether you\u2019re looking to integrate a CRM (Salesforce, Dynamics 365 CRM, and Sage CRM) or an ERP (Sage ERP, Acumatica) with each other or any other third-party application, GUMU\u2122 is a robust and reliable integrator tailored to your unique needs. Join us as we explore the abilities of GUMU\u2122 and learn how it transforms your integration experience. ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.greytrix.com\/blogs\/sagemas\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/#\/schema\/person\/b57e6e3564a12ef62967850ae0416728","name":"greysagemas","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.greytrix.com\/blogs\/sagemas\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c3b4325cb326e36467f945b9b9adf2bb85e907fe092d42eb36b39743b492e626?s=96&d=mm&r=g","caption":"greysagemas"},"url":"https:\/\/www.greytrix.com\/blogs\/sagemas\/author\/greysagemas\/"}]}},"_links":{"self":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/posts\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":3,"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/posts\/115\/revisions"}],"predecessor-version":[{"id":6213,"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/posts\/115\/revisions\/6213"}],"wp:attachment":[{"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/media?parent=115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/categories?post=115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.greytrix.com\/blogs\/sagemas\/wp-json\/wp\/v2\/tags?post=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}