
{"id":1703,"date":"2007-12-11T22:21:08","date_gmt":"2007-12-12T03:21:08","guid":{"rendered":"http:\/\/ikriv.com:8765\/blog\/?p=5"},"modified":"2007-12-11T22:21:08","modified_gmt":"2007-12-12T03:21:08","slug":"i-cant-believe-toolstripmergeindex-is-an-absolute-position","status":"publish","type":"post","link":"https:\/\/ikriv.com\/blog\/?p=1703","title":{"rendered":"I can&#039;t believe ToolStripItem.MergeIndex is an absolute position&#8230;"},"content":{"rendered":"<p>I was working with some integration project where menus of the shell and a plugin are merged a-la MDI.<br \/>\nBoth menus are <code>ToolStrip<\/code>s. We used <code>ToolStripManager.Merge()<\/code> to merge them.  It turns out that <code>MergeIndex<\/code> field of a source menu item is used as <font color=\"red\"><strong>absolute position<\/strong><\/font> where this item will be inserted in the target menu. <code>MergeIndex<\/code>es of the target menu items are ignored.<\/p>\n<p>E.g. if your source is (merge indexes in brackets)<br \/>\n<code>PluginMenu[2]<\/code><br \/>\nand your target is<br \/>\n<code>File View Help<\/code><br \/>\nthen merged menu will be<br \/>\n<code>File View PluginMenu Help<\/code>.<\/p>\n<p>If you later change the shell menu (target) to<br \/>\n<code>File Edit View Window Help<\/code><br \/>\nthen the merged menu will be<br \/>\n<code>File Edit PluginMenu View Window Help<\/code><\/p>\n<p>There is no way to specify something like &#8220;this plugin menu goes just before help&#8221; or &#8220;this plugin menu goes right after View&#8221;. Infragistics uses weights instead of absolute indexes. This creates much more sane and maintainable approach.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was working with some integration project where menus of the shell and a plugin are merged a-la MDI. Both menus are ToolStrips. We used ToolStripManager.Merge() to merge them. It <a href=\"https:\/\/ikriv.com\/blog\/?p=1703\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[3,4],"tags":[],"class_list":["entry","author-ikriv","post-1703","post","type-post","status-publish","format-standard","category-dotnet","category-hack"],"_links":{"self":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1703"}],"version-history":[{"count":0,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1703\/revisions"}],"wp:attachment":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}