{"id":4447,"date":"2012-05-31T12:56:00","date_gmt":"2012-05-31T20:56:00","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=4447"},"modified":"2012-06-01T09:37:00","modified_gmt":"2012-06-01T17:37:00","slug":"powershell-studio-2012-new-control-set-option","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2012\/05\/31\/powershell-studio-2012-new-control-set-option\/","title":{"rendered":"PowerShell Studio 2012: New Control Set Option"},"content":{"rendered":"<p>In the <a href=\"http:\/\/www.sapien.com\/blog\/2012\/05\/30\/powershell-studio-2012-service-release-v3-0-4\/\">service release<\/a> blog article we mentioned a new Control Set option for PowerShell Studio 2012 v3.0.4. In this article we will detail this option and how to use it.<\/p>\n<p><strong>\u201cUse Existing Type (Match Name)\u201d Option<\/strong><\/p>\n<p>When creating a control set you now have a new option that you can apply to non-visual controls such as ImageLists, ErrorProviders, etc. The \u201cUse Existing Type (Match Name)\u201d option functions similarly to the \u201cUse Existing Type\u201d. The difference is that that option will only use the existing type if the name of the non-visual control matches the name defined in the control set. Refer to the <a href=\"http:\/\/www.sapien.com\/blog\/2012\/04\/26\/powershell-studio-2012-whats-new-part-3\/\">PowerShell Studio: What\u2019s New? (Part 3)<\/a> blog article for more information on control sets and the \u201cUse Existing Type\u201d option. <\/p>\n<p><em>Why use this new option?<\/em><\/p>\n<p>Use this option when the same non-visual control will be used by multiple instances of your control set.<\/p>\n<p>For example, let\u2019s look at the new version of the Button \u2013 Start Job. This control set consists of a button and an ImageList which contains the images used to display a busy animation when the button is pressed. It doesn\u2019t make sense to insert multiple instances of the same ImageList, since all the button instances will use the same exact image frames to animate the button. Therefore when I created the control set, I set the ImageList\u2019s insertion action to \u201cUse Existing Type (Match Type)\u201d.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/05\/Use-Existing-Type-Match-Name.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Use Existing Type (Match Name)\" border=\"0\" alt=\"Use Existing Type (Match Name)\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/05\/Use-Existing-Type-Match-Name_thumb.png\" width=\"244\" height=\"172\"><\/a><\/p>\n<p>To illustrate the difference between settings we create two versions of the control set and inserted multiple instances into our form:<\/p>\n<p>Multiple Instances of the Control Set without Name Matching:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/05\/Control-Set-Without-Name-Matching.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Control Set Without Name Matching\" border=\"0\" alt=\"Control Set Without Name Matching\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/05\/Control-Set-Without-Name-Matching_thumb.png\" width=\"244\" height=\"169\"><\/a><\/p>\n<p>Multiple Instances of the Control Set with Name Matching:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/05\/Control-Set-With-Name-Matching.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Control Set With Name Matching\" border=\"0\" alt=\"Control Set With Name Matching\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/05\/Control-Set-With-Name-Matching_thumb.png\" width=\"244\" height=\"232\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Using the \u201cUse Existing Type&#8221; (Name Matching)\u201d option helped create a cleaner and leaner form. Only one instance of the ImageList is used by all the Start Job buttons; whereas the \u201cAlways Insert\u201d option inserted a copy for each button. <\/p>\n<p>Furthermore, we can use the \u201cName Matching\u201d option in conjunction with other controls sets. For example, if you insert the \u201cButton \u2013 Run Process\u201d control set, it will also use the same ImageList to animate its button.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/05\/Both-Control-Sets-Sharing-ImageList.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"Both Control Sets Sharing ImageList\" border=\"0\" alt=\"Both Control Sets Sharing ImageList\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2012\/05\/Both-Control-Sets-Sharing-ImageList_thumb.png\" width=\"244\" height=\"170\"><\/a><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Use Unique Names<\/strong><\/p>\n<p>When using the \u201cUse Existing Type&#8221; (Name Matching)\u201d option,&nbsp; it is highly recommended to use a unique name that will not conflict with another control set. For example, never use the default name such as \u201cimageList1\u201d, instead use a descriptive name like \u201cimageListButtonBusyAnimation\u201d.<\/p>\n<p>&nbsp;<\/p>\n<p>Hopefully you will be able to put the new option to good use when creating your own custom control sets.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the service release blog article we mentioned a new Control Set option for PowerShell Studio 2012 v3.0.4. In this article we will detail this option and how to use it. \u201cUse Existing Type (Match Name)\u201d Option When creating a control set you now have a new option that you can apply to non-visual controls [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[705,21,25],"tags":[694,712,28,1016,155],"class_list":["post-4447","post","type-post","status-publish","format-standard","hentry","category-powershell-studio-2012","category-software-news","category-windows-powershell","tag-694","tag-control-sets","tag-powershell","tag-powershell-studio","tag-service-release"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/4447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=4447"}],"version-history":[{"count":9,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/4447\/revisions"}],"predecessor-version":[{"id":4476,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/4447\/revisions\/4476"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=4447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=4447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=4447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}