<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Accessing a array instance variable is declared in VAR</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5b1de0597d/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5b1de0597d/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/5b1de0597d/</id><updated>2020-02-27T14:30:49.585000Z</updated><subtitle>Recent posts to Accessing a array instance variable is declared in VAR</subtitle><entry><title>Accessing a array instance variable is declared in VAR</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5b1de0597d/?limit=25#2447" rel="alternate"/><published>2020-02-27T14:30:49.585000Z</published><updated>2020-02-27T14:30:49.585000Z</updated><author><name>kyehyun</name><uri>https://forge.codesys.com/u/kyehyun/</uri></author><id>https://forge.codesys.com5230831e57637a06c8891ea2330ac8724ec0ac05</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;I'll try to create some methods to access internal variables indirectly.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Accessing a array instance variable is declared in VAR</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5b1de0597d/?limit=25#5863" rel="alternate"/><published>2020-02-27T14:30:49.028000Z</published><updated>2020-02-27T14:30:49.028000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com424df3b8133c7abd31b19dcf6e3507ffcc4ee272</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;VARs are considered private variables by design. This is desired and a good thing. Now, to address your situation...&lt;/p&gt;
&lt;p&gt;Option 1) create a method for FB_FrameBuffer, that's takes the 2D arguments as VAR_INPUTS and returns the FB_Pixel. This may, or may not be the best solution, depending on the size of FB_Pixel. &lt;/p&gt;
&lt;p&gt;Option 2) rethink your solution. If FB_Painter should not be bothered by buffering details, then it should not need direct access to the array. Instead, FB_FrameBuffer should have methods and properties that FB_Painter can use to command general things like: GetNextPixel() or MoveLeft() or whatever you are trying to achieve. If FB_Painter should access the 2D array, then maybe it should be defined there, which then why have FB_FrameBuffer....&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Accessing a array instance variable is declared in VAR</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/5b1de0597d/?limit=25#26cb" rel="alternate"/><published>2020-02-27T14:30:47.693000Z</published><updated>2020-02-27T14:30:47.693000Z</updated><author><name>kyehyun</name><uri>https://forge.codesys.com/u/kyehyun/</uri></author><id>https://forge.codesys.com3fa550a8db8f953b62697ae64862680356522fc5</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I've created three of FBs : FB_Framebuffer, FB_Pixel, FB_Painter. And I've added a instance for 2D array of FB_Pixel in FB_Framebuffer. &lt;/p&gt;
&lt;p&gt;As you see the code, In FB_Painter I want to access the 2D array variable is declared in VAR. &lt;br/&gt;
But, I couldn't access it. How can I access the instance variable keeping it in VAR region of FB_Framebuffer without VAR_IN or VAR_OUT? Is it possible via Property, Reference or Pointer?&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="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;FB_Framebuffer&lt;/span&gt;
&lt;span class="n"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;Buffer&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;ARRAY&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;..&lt;/span&gt;&lt;span class="mi"&gt;1023&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;OF&lt;/span&gt; &lt;span class="n"&gt;FB_Pixel&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;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="err"&gt; &lt;/span&gt; &lt;span class="n"&gt;FB_Painter&lt;/span&gt;
&lt;span class="n"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt; &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;&lt;span class="n"&gt;FrameBuffer&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;FB_Framebuffer&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;/div&gt;</summary></entry></feed>