{"id":570,"date":"2020-01-27T07:33:00","date_gmt":"2020-01-27T14:33:00","guid":{"rendered":"https:\/\/www.great-white-software.com\/blog\/?p=570"},"modified":"2020-01-24T09:10:12","modified_gmt":"2020-01-24T16:10:12","slug":"things-you-should-not-rename-in-xojo","status":"publish","type":"post","link":"https:\/\/www.great-white-software.com\/blog\/2020\/01\/27\/things-you-should-not-rename-in-xojo\/","title":{"rendered":"Things you should not rename in Xojo"},"content":{"rendered":"\n<p>There aren&#8217;t a lot of items in a Xojo desktop project that you can&#8217;t rename. You can change the name of the App instance, the default window, the default menu bar and many many others.<\/p>\n\n\n\n<p>But there are a handful that, if you do rename them, you may inadvertently break your application. This is entirely due to how the Xojo framework works, and in part how macOS itself works.<\/p>\n\n\n\n<p>One group of items you should not rename is several Edit Menu items. Do not rename EditCut, EditPaste, EditClear, and EditSelectAll. The reason is, that if you do, then certain classes in the Xojo framework will no longer handle those menu items by default.<\/p>\n\n\n\n<p>The simplest demo of this is to<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>start a new desktop project<\/li><li>add a TextArea to the default window &#8211; Window1<\/li><li>run<\/li><\/ul>\n\n\n\n<p>Now if you type in text to the text area and press the shortcut for Select All (\u2318-A or Ctrl-A) the text area will automatically handle selecting all the text.<\/p>\n\n\n\n<p>Quit your little demo app and in the menu editor rename <em>EditSelectAll<\/em> to <em>MyEditSelectAll<\/em>.<\/p>\n\n\n\n<p>Run the small sample again. Perform the same test by adding a bunch of text and trying to use the shortcut. This time the menu shortcut is NOT automatically handled and likely just beeps at you.<\/p>\n\n\n\n<p>Several controls have behaviour that is pre-configured to rely on the Edit Menu items being named in a specific way. I&#8217;ve written about how <a href=\"https:\/\/www.great-white-software.com\/blog\/2019\/06\/28\/dynamic-menu-handling\/\">you can do this as well before<\/a>. Renaming the Edit Menu items then breaks that automatic configuration.<\/p>\n\n\n\n<p>The other thing that renaming is specific to macOS. On macOS the OS will automatically add new menu items, the ones for Start Dictation and Emoji &amp; Symbols, to the edit menu IF it the TEXT of the for the Edit Menu title is &#8220;Edit&#8221;. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1222\" height=\"908\" src=\"https:\/\/i1.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.46.45-AM.png?fit=525%2C390&amp;ssl=1\" alt=\"\" class=\"wp-image-571\" srcset=\"https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.46.45-AM.png?w=1222&amp;ssl=1 1222w, https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.46.45-AM.png?resize=300%2C223&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.46.45-AM.png?resize=1024%2C761&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.46.45-AM.png?resize=768%2C571&amp;ssl=1 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>If you alter it to anything else then  macOS will not find the correct menu to insert these items and they will not be added to your Edit Menu.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1218\" height=\"912\" src=\"https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.47.41-AM.png?fit=525%2C393&amp;ssl=1\" alt=\"\" class=\"wp-image-572\" srcset=\"https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.47.41-AM.png?w=1218&amp;ssl=1 1218w, https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.47.41-AM.png?resize=300%2C225&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.47.41-AM.png?resize=1024%2C767&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.great-white-software.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-7.47.41-AM.png?resize=768%2C575&amp;ssl=1 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n\n\n\n<p>Again this is easy to test with the tiny sample app we have so far. Just change the Edit menus text to Edit followed by a space and run. When you click on the Edit menu you will not longer have the 2 automatically added items.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There aren&#8217;t a lot of items in a Xojo desktop project that you can&#8217;t rename. You can change the name of the App instance, the default window, the default menu bar and many many others. But there are a handful that, if you do rename them, you may inadvertently break your application. This is entirely &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.great-white-software.com\/blog\/2020\/01\/27\/things-you-should-not-rename-in-xojo\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Things you should not rename in Xojo&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-570","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/comments?post=570"}],"version-history":[{"count":1,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/570\/revisions"}],"predecessor-version":[{"id":573,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/570\/revisions\/573"}],"wp:attachment":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/media?parent=570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/categories?post=570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/tags?post=570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}