<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/</id><updated>2020-02-27T13:47:47.535000Z</updated><subtitle>Recent posts to Advice on OOP Code Structure</subtitle><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#f631" rel="alternate"/><published>2020-02-27T13:47:47.535000Z</published><updated>2020-02-27T13:47:47.535000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com48f08e40d0b8e101f669537607e2c6e7b01fc92f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; scott_cunningham&lt;/p&gt;
&lt;p&gt;VAR_INPUTs in FB_INITs are required during instantiation (so you at least force a reference link at compile).  A VAR_INPUT in a FB does not have to be filled (so if the coder does not link, no compile error, but the FB does not work right).&lt;/p&gt;
&lt;p&gt;If you insert the instance using the F2 key, then CoDeSys will add the variable to the instance definition.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#cfe2" rel="alternate"/><published>2020-02-27T13:47:47.426000Z</published><updated>2020-02-27T13:47:47.426000Z</updated><author><name>peterpeter4078</name><uri>https://forge.codesys.com/u/peterpeter4078/</uri></author><id>https://forge.codesys.com3982cbd6447bd52fdf82023ae786f6e3cf36d621</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;br/&gt;
i know the last post is quite old, but i think my questions fits perfect to this topic and discussion in this thread:&lt;/p&gt;
&lt;p&gt;Thanks to your posts and examples I start to build up my programm in CodeSys with OOP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update: I figured out, that this is not working. But is it possible to get the help window with the FB_INIT?&lt;/strong&gt;&lt;br/&gt;
Whats the benefit of using the VAR_INPUT of the FB_init method instead of the VAR_INPUT in the FB?&lt;br/&gt;
For the scott_cunningham example -&amp;gt; put the  in the  FB:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;FUNCTION_BLOCK&lt;/span&gt; &lt;span class="n"&gt;ClassOilTemperature&lt;/span&gt;
&lt;span class="n"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;RefTemp&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;REFERENCE&lt;/span&gt; &lt;span class="k"&gt;TO&lt;/span&gt; &lt;span class="n"&gt;UINT&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And then use the FB_init only for linking:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nv"&gt;METHOD&lt;/span&gt; &lt;span class="nv"&gt;FB_init&lt;/span&gt; : &lt;span class="nv"&gt;BOOL&lt;/span&gt;
&lt;span class="nv"&gt;VAR_INPUT&lt;/span&gt;
   &lt;span class="nv"&gt;bInitRetains&lt;/span&gt; : &lt;span class="nv"&gt;BOOL&lt;/span&gt;&lt;span class="c1"&gt;; // if TRUE, the retain variables are initialized (warm start / cold start)&lt;/span&gt;
   &lt;span class="nv"&gt;bInCopyCode&lt;/span&gt; : &lt;span class="nv"&gt;BOOL&lt;/span&gt;&lt;span class="c1"&gt;;  // if TRUE, the instance afterwards gets moved into the copy code (online change)&lt;/span&gt;
&lt;span class="nv"&gt;END_VAR&lt;/span&gt;
&lt;span class="nv"&gt;THIS&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;.&lt;span class="nv"&gt;RawTemp&lt;/span&gt; &lt;span class="nv"&gt;REF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;THIS&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;.&lt;span class="nv"&gt;RefTemp&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Because, by using the VAR_INPUT it is possbile to get the help window during object creating:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;OilTemp&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ClassOilTemperature&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Help Window:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;FUNCTION_BLOCK&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ClassOilTemperature&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="n"&gt;VAR_IN&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="n"&gt;/b&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="n"&gt;PUT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;RefTemp&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;REFERENCE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;TO&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Uint&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Peter&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#0b8a" rel="alternate"/><published>2020-02-27T13:47:47.378000Z</published><updated>2020-02-27T13:47:47.378000Z</updated><author><name>GaryPratt</name><uri>https://forge.codesys.com/u/garypratt/</uri></author><id>https://forge.codesys.com28e90b539d59ee68c3c58ea1e995df654b0357ae</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Part of this video might be helpful (at time 1:25) ...&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://youtu.be/BYUVrKG22Xg?t=5150" rel="nofollow"&gt;https://youtu.be/BYUVrKG22Xg?t=5150&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As may parts of this article: &lt;a class="" href="https://www.isa.org/intech/20161005/" rel="nofollow"&gt;https://www.isa.org/intech/20161005/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Gary&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#cd31" rel="alternate"/><published>2020-02-27T13:47:47.328000Z</published><updated>2020-02-27T13:47:47.328000Z</updated><author><name>rickj</name><uri>https://forge.codesys.com/u/rickj/</uri></author><id>https://forge.codesys.com388523694a8c0158b4318b3f59b77469ea4cd722</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;To those who read my article and downloaded the example project I sincerely apologize for having linked to the wrong file.  I have discovered and corrected my error.  &lt;/p&gt;
&lt;p&gt;The example project is here: &lt;br/&gt;
&lt;a class="" href="http://mitek-automation.com/download_file/199" rel="nofollow"&gt;http://mitek-automation.com/download_file/199&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The article is here: &lt;br/&gt;
&lt;a class="" href="http://www.controleng.com/single-article/plc-object-oriented-programming-benefits/f195e4f9dd6e6006bdca63059c1945fb.html" rel="nofollow"&gt;http://www.controleng.com/single-articl ... 945fb.html&lt;/a&gt; m &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#8b15" rel="alternate"/><published>2020-02-27T13:47:47.268000Z</published><updated>2020-02-27T13:47:47.268000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comf81b824c7d935464c3993d82a74fa1c422fbd3de</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; scott_cunningham&lt;/p&gt;
&lt;p&gt;I believe the attribute 'monitoring':='call' is for debugging. It forces a creation of a temporary variable so you can view the get in the online debug mode. Side effect is a property "get" works....&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#3b5c" rel="alternate"/><published>2020-02-27T13:47:47.221000Z</published><updated>2020-02-27T13:47:47.221000Z</updated><author><name>Joan M</name><uri>https://forge.codesys.com/u/joan-m/</uri></author><id>https://forge.codesys.come18797d2d9bc08acaabe953c6485707f026e2cd9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;@scott_cunningham&lt;/p&gt;
&lt;p&gt;Have not looked into the help file (guilty of that), but reading this post  l &lt;a class="" href="http://forum.codesys.com/viewtopic.php?f=11&amp;amp;t=7170&amp;amp;start=15&amp;amp;p=15982&amp;amp;lan=en" rel="nofollow"&gt;viewtopic.php?f=11&amp;amp;t=7170&amp;amp;start=15#p15982&lt;/a&gt; l  some posts before this one in this same thread seems to say the opposite, moreover I've been able to read the value of a property, but not set it.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#dfba" rel="alternate"/><published>2020-02-27T13:47:47.163000Z</published><updated>2020-02-27T13:47:47.163000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.comdffbafb752e61df4f9bc30bb7a8f156ccaeae2d9</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; scott_cunningham&lt;/p&gt;
&lt;p&gt;I think the help file specifically said you cannot call properties from a visu entry&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#7272" rel="alternate"/><published>2020-02-27T13:47:47.118000Z</published><updated>2020-02-27T13:47:47.118000Z</updated><author><name>Joan M</name><uri>https://forge.codesys.com/u/joan-m/</uri></author><id>https://forge.codesys.comd65bda502f633b58755ea0a4df83ccc4d1a9a4c7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Dear yannickasselin1, we tried that without luck... who knows it could be a Schneider issue...&lt;/p&gt;
&lt;p&gt;Any other idea?&lt;/p&gt;
&lt;p&gt;Thank you very much in advance!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#6a95" rel="alternate"/><published>2020-02-27T13:47:47.065000Z</published><updated>2020-02-27T13:47:47.065000Z</updated><author><name>yannickasselin1</name><uri>https://forge.codesys.com/u/yannickasselin1/</uri></author><id>https://forge.codesys.comcf1aea6275cf41d071c8a17224843a7674df89b5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Add the pragma {attribute 'monitoring':='call'} in the declaration of the property.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Advice on OOP Code Structure</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/49f235f440/?limit=25&amp;page=1#c05a" rel="alternate"/><published>2020-02-27T13:47:47.006000Z</published><updated>2020-02-27T13:47:47.006000Z</updated><author><name>Joan M</name><uri>https://forge.codesys.com/u/joan-m/</uri></author><id>https://forge.codesys.comd7ec337ede95492529e753cbe88599c28dfc3444</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello all,&lt;/p&gt;
&lt;p&gt;I've been trying to read and write to a property from the Visualization without luck.&lt;/p&gt;
&lt;p&gt;Reading works perfectly using the FRAME* trick stated before in this thread, but when I try to write into the property it never happens.&lt;/p&gt;
&lt;p&gt;Do I have to make something special to get this working? Is it possible to write to a property from Visu?&lt;/p&gt;
&lt;p&gt;As always thank you in advance.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;FRAME TRICK:&lt;/li&gt;
&lt;li&gt;Create a frame, configure the reference to the property, use that reference inside the frame.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Joan.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>