{"id":937,"date":"2011-12-21T18:04:05","date_gmt":"2011-12-21T12:34:05","guid":{"rendered":"http:\/\/www.automationrepository.com\/?p=937"},"modified":"2011-12-21T18:14:39","modified_gmt":"2011-12-21T12:44:39","slug":"understanding-registeruserfunc-syntax-with-example","status":"publish","type":"post","link":"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/","title":{"rendered":"Understanding RegisterUserFunc Syntax with Example"},"content":{"rendered":"<div style=\"text-align: justify; font-family: Verdana;\">\n<p>In this article, we&#8217;ll have a look at the syntax of RegisterUserFunc statement. We&#8217;ll also try to understand the syntax with the help of an example.<br \/>\n<span style=\"text-decoration: underline;\"><strong><br \/>\nSyntax<\/strong><\/span><br \/>\n<strong>RegisterUserFunc<\/strong> <em>TOClass, MethodName, FunctionName, SetAsDefault<!--more--><\/em><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"97\"><strong><span style=\"font-family: Calibri;\">Argument<\/span><\/strong><\/td>\n<td valign=\"top\" width=\"60\"><strong><span style=\"font-family: Calibri;\">Type<\/span><\/strong><\/td>\n<td valign=\"top\" width=\"396\"><strong><span style=\"font-family: Calibri;\">Description<\/span><\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"97\"><span style=\"font-family: Calibri;\">TOClass<\/span><\/td>\n<td valign=\"top\" width=\"60\"><span style=\"font-family: Calibri;\">String<\/span><\/td>\n<td valign=\"top\" width=\"396\"><span style=\"font-family: Calibri;\">The Object with which you want to register the method. Eg: WebEdit, WebButton etc<\/span><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"97\"><span style=\"font-family: Calibri;\">MethodName<\/span><\/td>\n<td valign=\"top\" width=\"60\"><span style=\"font-family: Calibri;\">String<\/span><\/td>\n<td valign=\"top\" width=\"396\"><span style=\"font-family: Calibri;\">The name that you want to use while calling the method. Eg: For a WebButton, it can be fnWebButtonClick<\/span><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"97\"><span style=\"font-family: Calibri;\">FunctionName<\/span><\/td>\n<td valign=\"top\" width=\"60\"><span style=\"font-family: Calibri;\">String<\/span><\/td>\n<td valign=\"top\" width=\"396\"><span style=\"font-family: Calibri;\">The actual name of the user-defined function, i.e. the name that is used during function definition.<\/span><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"97\"><span style=\"font-family: Calibri;\">SetAsDefault<\/span><\/td>\n<td valign=\"top\" width=\"60\"><span style=\"font-family: Calibri;\">Boolean<\/span><\/td>\n<td valign=\"top\" width=\"396\"><span style=\"font-family: Calibri;\"><strong>Optional<\/strong>. Indicates whether the registered function is used as the default operation for the test object.\u00a0 <\/span><strong><em><span style=\"font-family: Calibri;\">Default Value: False<\/span><\/em><\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"text-decoration: underline;\"><strong><br \/>\nExample:<\/strong><\/span> Let&#8217;s try to understand the above syntax with the help of an example. Consider a scenario where you want to create a single generic function &#8216;fnClick&#8217; and use it for WebButton, Link &amp; Image objects. Also the function calls should be different for each control. Eg: for Links the function name should be fnLinkClick, for WebButton the name should be fnWebButtonClick etc.<\/p>\n<p>So RegisterUserFunc arguments would have the following values &#8211;<br \/>\n1. <span style=\"text-decoration: underline;\">TOClass<\/span> &#8211; WebButton, Link, Image<br \/>\n2. <span style=\"text-decoration: underline;\">MethodName<\/span> &#8211; fnWebButtonClick, fnLinkClick, fnImageClick<br \/>\n3. <span style=\"text-decoration: underline;\">FunctionName<\/span> &#8211; fnClick<\/p>\n<p>Let&#8217;s see the code for the same.<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n'===== Code in Function Library =====\r\nRegisterUserFunc &quot;WebButton&quot;, &quot;fnWebButtonClick&quot;, &quot;fnClick&quot;\r\nRegisterUserFunc &quot;Link&quot;, &quot;fnLinkClick&quot;, &quot;fnClick&quot;\r\nRegisterUserFunc &quot;Image&quot;, &quot;fnImageClick&quot;, &quot;fnClick&quot;\r\n\r\nFunction fnClick(objControl)\r\n objControl.Click\r\nEnd Function\r\n\r\n'===== Code in Action =====\r\nBrowser(&quot;B&quot;).Page(&quot;P&quot;).WebButton(&quot;btn&quot;).fnWebButtonClick\r\nBrowser(&quot;B&quot;).Page(&quot;P&quot;).Link(&quot;lnk&quot;).fnLinkClick\r\nBrowser(&quot;B&quot;).Page(&quot;P&quot;).Image(&quot;img&quot;).fnImageClick\r\n<\/pre>\n<p><em><br \/>\n<\/em><\/p>\n<\/div>\n<div style=\"font-family: Verdana,sans-serif; border: 1px solid #C8B560; padding: 3mm; background: #FFF8C6; text-align: center;\">\n<p>If you enjoy our articles, you can join our blog to get\u00a0new articles delivered directly in your inbox.<\/p>\n<form style=\"text-align: center;\" action=\"http:\/\/feedburner.google.com\/fb\/a\/mailverify\" method=\"post\" onsubmit=\"window.open('http:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=automationrepository\/feeds', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true\" target=\"popupwindow\"><input style=\"width: 160px; height: 20px;\" onfocus=\"if (this.value == 'Enter Your Email Address') {this.value = '';}\" onblur=\"if (this.value == '') {this.value = 'Enter Your Email Address';}\" type=\"text\" value=\"Enter Your Email Address\" \/> <input type=\"hidden\" name=\"uri\" value=\"automationrepository\/feeds\" \/> <input type=\"hidden\" name=\"loc\" value=\"en_US\" \/> <input type=\"submit\" value=\"Join Us\" \/><\/p>\n<p style=\"text-align: justify;\">\u00a0<\/p>\n<\/form>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we&#8217;ll have a look at the syntax of RegisterUserFunc statement. We&#8217;ll also try to understand the syntax with the help of an example. Syntax RegisterUserFunc TOClass, MethodName, FunctionName, SetAsDefault<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,9],"tags":[53],"class_list":["post-937","post","type-post","status-publish","format-standard","hentry","category-qtp-basic-stuff","category-qtp-concepts","tag-registeruserfunc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Understanding RegisterUserFunc Syntax with Example - XX<\/title>\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.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Anish Pillai\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/\",\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/\",\"name\":\"Understanding RegisterUserFunc Syntax with Example - XX\",\"isPartOf\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#website\"},\"datePublished\":\"2011-12-21T12:34:05+00:00\",\"dateModified\":\"2011-12-21T12:44:39+00:00\",\"author\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/7a35710e1ce89e5fb481be88fcd6cd20\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.automationrepository.com\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding RegisterUserFunc Syntax with Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#website\",\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/\",\"name\":\"XX\",\"description\":\"\\r\\nasas\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.automationrepository.com\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/7a35710e1ce89e5fb481be88fcd6cd20\",\"name\":\"Anish Pillai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8aa984de2295c3c4078fa48f6ba5d91e7c849b1a27a11dca24c6f11dd673ba14?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8aa984de2295c3c4078fa48f6ba5d91e7c849b1a27a11dca24c6f11dd673ba14?s=96&d=mm&r=g\",\"caption\":\"Anish Pillai\"},\"description\":\"Find more about Anish Pillai on Google+\",\"sameAs\":[\"http:\/\/www.automationrepository.com\"],\"url\":\"https:\/\/www.automationrepository.com\/wordpress\/author\/anish\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Understanding RegisterUserFunc Syntax with Example - XX","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.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/","twitter_misc":{"Written by":"Anish Pillai","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/","url":"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/","name":"Understanding RegisterUserFunc Syntax with Example - XX","isPartOf":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/#website"},"datePublished":"2011-12-21T12:34:05+00:00","dateModified":"2011-12-21T12:44:39+00:00","author":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/7a35710e1ce89e5fb481be88fcd6cd20"},"breadcrumb":{"@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.automationrepository.com\/wordpress\/2011\/12\/understanding-registeruserfunc-syntax-with-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.automationrepository.com\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Understanding RegisterUserFunc Syntax with Example"}]},{"@type":"WebSite","@id":"https:\/\/www.automationrepository.com\/wordpress\/#website","url":"https:\/\/www.automationrepository.com\/wordpress\/","name":"XX","description":"\r\nasas","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.automationrepository.com\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/7a35710e1ce89e5fb481be88fcd6cd20","name":"Anish Pillai","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.automationrepository.com\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8aa984de2295c3c4078fa48f6ba5d91e7c849b1a27a11dca24c6f11dd673ba14?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8aa984de2295c3c4078fa48f6ba5d91e7c849b1a27a11dca24c6f11dd673ba14?s=96&d=mm&r=g","caption":"Anish Pillai"},"description":"Find more about Anish Pillai on Google+","sameAs":["http:\/\/www.automationrepository.com"],"url":"https:\/\/www.automationrepository.com\/wordpress\/author\/anish\/"}]}},"_links":{"self":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/comments?post=937"}],"version-history":[{"count":9,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/937\/revisions"}],"predecessor-version":[{"id":946,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/posts\/937\/revisions\/946"}],"wp:attachment":[{"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/media?parent=937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/categories?post=937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.automationrepository.com\/wordpress\/wp-json\/wp\/v2\/tags?post=937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}