<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/</id><updated>2020-02-27T14:23:38.459000Z</updated><subtitle>Recent posts to Interface member in a FB</subtitle><entry><title>Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/?limit=25#ffba" rel="alternate"/><published>2020-02-27T14:23:38.459000Z</published><updated>2020-02-27T14:23:38.459000Z</updated><author><name>josepmariarams</name><uri>https://forge.codesys.com/u/josepmariarams/</uri></author><id>https://forge.codesys.com9db970a42b0d20f7b54865daeea615d1dba5c356</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;_dParams is a system struct or is filled by you?&lt;/p&gt;
&lt;p&gt;Enviat des del meu Aquaris M5.5 usant Tapatalk&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/?limit=25#f8ab" rel="alternate"/><published>2020-02-27T14:23:37.952000Z</published><updated>2020-02-27T14:23:37.952000Z</updated><author><name>josepmariarams</name><uri>https://forge.codesys.com/u/josepmariarams/</uri></author><id>https://forge.codesys.com522793bfedd01f9dd4bfb7968ad820e2a058296f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am out and i cannot send an example.&lt;/p&gt;
&lt;p&gt;Simply extend fbalarm with fbdevice.&lt;/p&gt;
&lt;p&gt;Fbalarm extends fbdevice.&lt;/p&gt;
&lt;p&gt;You can erase all references to any interface.&lt;/p&gt;
&lt;p&gt;You can think about interfaces or fb extension more or less:&lt;/p&gt;
&lt;p&gt;Fb extension: when  diferents fb have a method with the same code inside and the same name.&lt;/p&gt;
&lt;p&gt;Interface:when diferents fb have a method with the same name and diferent code inside.&lt;/p&gt;
&lt;p&gt;Enviat des del meu Aquaris M5.5 usant Tapatalk&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/?limit=25#35a2" rel="alternate"/><published>2020-02-27T14:23:36.659000Z</published><updated>2020-02-27T14:23:36.659000Z</updated><author><name>wpmccormick</name><uri>https://forge.codesys.com/u/wpmccormick/</uri></author><id>https://forge.codesys.comaa9ef732c38acffea6a1e88f0de4d39ed44de338</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;scott_cunningham hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
You get an exception because your _device ref variable is never assigned to an actual object. When you use “myvar : REFERENCE TO MyInterface” you are telling the compiler to expect the object to implement the interface MyInterface, but you haven’t actually defined the actual object.  These types of errors really only appear when you actually run the project, although you may be able to active a compiler warning - check the options. &lt;br/&gt;
Interfaces are basically a template of what an object is required to code or implement when that object (Finction Block) implements The interface.&lt;br/&gt;
You can use the keyword EXTEND to extend a function block.  Then you can use the SUPER^ keyword to access the base FB variables and methods.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;My bad. I didn't include the the part where I assign the object ... but I do. Could the issue be that the FB's and Interfaces' are defined in a library? The help file contains the following: &amp;gt;&lt;strong&gt;Zitat:&lt;/strong&gt;&lt;br/&gt;
The requirement for the explicit conversion is that both the ITF_Source and ITF_Dest are derived from Interface __System.IQueryInterface. This interface is implicitly available does not require a library. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/?limit=25#9a9a" rel="alternate"/><published>2020-02-27T14:23:36.189000Z</published><updated>2020-02-27T14:23:36.189000Z</updated><author><name>wpmccormick</name><uri>https://forge.codesys.com/u/wpmccormick/</uri></author><id>https://forge.codesys.combc0d2bb5bc7b62127764b9a933325889e2905e6f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Yes, _dParams is a STRUCT.&lt;/p&gt;
&lt;p&gt;I'm sorry, but the language barrier is making it hard for me to understand your earlier reply.&lt;/p&gt;
&lt;p&gt;Maybe you could post a working example?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/?limit=25#4c00" rel="alternate"/><published>2020-02-27T14:23:35.781000Z</published><updated>2020-02-27T14:23:35.781000Z</updated><author><name>josepmariarams</name><uri>https://forge.codesys.com/u/josepmariarams/</uri></author><id>https://forge.codesys.com726a8dd546c637fb527da064e43260bad38440a7</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi.&lt;/p&gt;
&lt;p&gt;A question.&lt;/p&gt;
&lt;p&gt;What is _dParams, is an structure that you have created?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Enviat des del meu Aquaris M5.5 usant Tapatalk&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/?limit=25#6736" rel="alternate"/><published>2020-02-27T14:23:34.540000Z</published><updated>2020-02-27T14:23:34.540000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com881f74d249e4e6430ef2ab9f5c697d087562186c</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;You get an exception because your _device ref variable is never assigned to an actual object. When you use “myvar : REFERENCE TO MyInterface” you are telling the compiler to expect the object to implement the interface MyInterface, but you haven’t actually defined the actual object.  These types of errors really only appear when you actually run the project, although you may be able to active a compiler warning - check the options. &lt;/p&gt;
&lt;p&gt;Interfaces are basically a template of what an object is required to code or implement when that object (Finction Block) implements The interface.&lt;/p&gt;
&lt;p&gt;You can use the keyword EXTEND to extend a function block.  Then you can use the SUPER^ keyword to access the base FB variables and methods.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/?limit=25#7b9e" rel="alternate"/><published>2020-02-27T14:23:34.077000Z</published><updated>2020-02-27T14:23:34.077000Z</updated><author><name>josepmariarams</name><uri>https://forge.codesys.com/u/josepmariarams/</uri></author><id>https://forge.codesys.com04318ea6eb9175e66ac59f71b2a9ed3ba2b20d6c</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Who has to implement itf is alarm. Inside alarm you has an reference which points to no anybody.&lt;/p&gt;
&lt;p&gt;As all fb can return his id, instead implement _device you can extend fb_device. Which is not necessary that implements _device. You can treat all your fb as fb_device.&lt;/p&gt;
&lt;p&gt;Be healty!&lt;/p&gt;
&lt;p&gt;Enviat des del meu Aquaris M5.5 usant Tapatalk&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Interface member in a FB</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/fa6a31adc7/?limit=25#ef52" rel="alternate"/><published>2020-02-27T14:23:33.533000Z</published><updated>2020-02-27T14:23:33.533000Z</updated><author><name>wpmccormick</name><uri>https://forge.codesys.com/u/wpmccormick/</uri></author><id>https://forge.codesys.comafb9f8248da5be0b23fd8fe3ea6ff4448211de1e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I want to have some base class FB as a member of another FB. The way I though this could be achieved was through an Interface. My application compiles and loads, but when I try to access one of the FB/Interface properties I get an exception. Code is something like this:&lt;/p&gt;
&lt;p&gt;INTERFACE ITF_Device EXTENDS __SYSTEM.IQueryInterface&lt;br/&gt;
PROPERTY CID : UDINT&lt;/p&gt;
&lt;p&gt;FUNCTION_BLOCK fbDevice IMPLEMENTS ITF_Device&lt;br/&gt;
PROPERTY CID : UDINT&lt;br/&gt;
GET: CID := THIS^._dParams.ComponentID;&lt;/p&gt;
&lt;p&gt;FUNCTION_BLOCK fbALARM&lt;br/&gt;
VAR&lt;br/&gt;
    _device: REFERENCE TO ITF_Device;&lt;br/&gt;
END_VAR&lt;br/&gt;
METHOD GetData&lt;br/&gt;
ComponentNumber := THIS^._device.CID;&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>