<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Function block method default arguments</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/379e2d83ed/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/379e2d83ed/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/379e2d83ed/</id><updated>2024-01-04T14:14:34.783000Z</updated><subtitle>Recent posts to Function block method default arguments</subtitle><entry><title>Function block method default arguments</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/379e2d83ed/?limit=25#3812" rel="alternate"/><published>2024-01-04T14:14:34.783000Z</published><updated>2024-01-04T14:14:34.783000Z</updated><author><name>joanm</name><uri>https://forge.codesys.com/u/joanm/</uri></author><id>https://forge.codesys.coma218635f459882759a6b9a012fc21e26d70c9ac2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The new TwinCAT 4026 will add those default parameters, as TwinCAT drinks from Codesys I guess that will be implemented soon (or maybe, it already is given what tvm says in the previous post). &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function block method default arguments</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/379e2d83ed/?limit=50#fbd9" rel="alternate"/><published>2024-01-04T14:04:54.770000Z</published><updated>2024-01-04T14:04:54.770000Z</updated><author><name>tvm</name><uri>https://forge.codesys.com/u/tvm/</uri></author><id>https://forge.codesys.comf611266bff266f0b5cc34e5d5590c16d3b82e1df</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;This works for me in Schneider Machine Expert 2.2, which is based on Codesys 3.5.19.&lt;br/&gt;
It did not work in Machine Expert 2.1, which was based on Codesys 3.5.16.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;METHOD&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;PUBLIC&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;Method1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;INT&lt;/span&gt;
&lt;span class="nt"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;TestVar&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nt"&gt;INT&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;5&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;

&lt;span class="nt"&gt;Method1&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TestVar&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nt"&gt;PROGRAM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;SR_Main&lt;/span&gt;
&lt;span class="nt"&gt;VAR&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;TestFB&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="nt"&gt;TEST_FB&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;Var1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt;           &lt;/span&gt;&lt;span class="nt"&gt;INT&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;END_VAR&lt;/span&gt;

&lt;span class="nt"&gt;Var1&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TestFB&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Method1&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry><entry><title>Function block method default arguments</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/379e2d83ed/?limit=50#c646" rel="alternate"/><published>2023-12-22T10:15:40.327000Z</published><updated>2023-12-22T10:15:40.327000Z</updated><author><name>SiegeLion</name><uri>https://forge.codesys.com/u/smartcoco/</uri></author><id>https://forge.codesys.comed431c580f7a7ce8ccba8b7666de5b342d09370a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;It's not that you missed something, it's that CODESYS doesn't have this feature. I hope CODESYS can add this feature.&lt;/p&gt;
&lt;p&gt;We also hope to add function overload functionality.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Function block method default arguments</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/379e2d83ed/?limit=25#1ad2" rel="alternate"/><published>2023-12-21T15:14:14.562000Z</published><updated>2023-12-21T15:14:14.562000Z</updated><author><name>sean-barton</name><uri>https://forge.codesys.com/u/sean-barton/</uri></author><id>https://forge.codesys.comf89fde857246fe01be50d38209664a3fd6ce562f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I have default arguments specified for function block methods but when calling a method, an error is produced requiring me to supply all the arguments despite there being default values. &lt;/p&gt;
&lt;p&gt;According to the online documentation, under section "Calling a Method" and subsection "argument passing" of the following link:&lt;br/&gt;
&lt;a href="https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_obj_method.html" rel="nofollow"&gt;https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_obj_method.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;"Passing an argument for an input ... can be omitted ... for which a default or initial value was specified in the declaration..."&lt;/p&gt;
&lt;p&gt;I have found this to be the case for all Codesys IDEs I've used, 3.5.11, 3.5.16, 3.5.17, 3.5.19.&lt;/p&gt;
&lt;p&gt;Am I missing something?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>