<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Init for visualization owned fb</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/</id><updated>2023-06-24T17:47:59.145000Z</updated><subtitle>Recent posts to Init for visualization owned fb</subtitle><entry><title>Init for visualization owned fb</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/?limit=25#59b8/6abc/0b0b" rel="alternate"/><published>2023-06-24T17:47:59.145000Z</published><updated>2023-06-24T17:47:59.145000Z</updated><author><name>thecolonel26</name><uri>https://forge.codesys.com/u/thecolonel26/</uri></author><id>https://forge.codesys.comc7ea723c9cdeff99193da37ecdf34120a19357f4</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;The impression I got from them was that everything on that list had been asked for by other users long ago (Except for function pointers/delegates). They said they were on their "back log" list.&lt;/p&gt;
&lt;p&gt;So I assume they will never happen. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Init for visualization owned fb</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/?limit=25#59b8/6abc" rel="alternate"/><published>2023-06-18T02:55:49.935000Z</published><updated>2023-06-18T02:55:49.935000Z</updated><author><name>smartcoco</name><uri>https://forge.codesys.com/u/smartcoco/</uri></author><id>https://forge.codesys.com32f501cc2875ee410d13d0202fbb0337279aab37</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;How did they answer?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Init for visualization owned fb</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/?limit=50#30eb" rel="alternate"/><published>2022-09-01T14:46:59.048000Z</published><updated>2022-09-01T14:46:59.048000Z</updated><author><name>tvm</name><uri>https://forge.codesys.com/u/tvm/</uri></author><id>https://forge.codesys.comf93242a7d8ee03f163beb3ff1d41750956ba8302</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;create a function:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;FUNCTION INITFB:    FB_Menu;&lt;/span&gt;
&lt;span class="err"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="err"&gt;    Var1:       BOOL;&lt;/span&gt;
&lt;span class="err"&gt;    //whatever initialization parameters you want&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;span class="err"&gt;FB_Menu.Var1:= Var1;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Then, in your visu&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt;    fb:     FB_Menu:= INITFB(Var1:= TRUE);&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;you might be able to do the same thing with properties of FB_Menu&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;FUNCTION_BLOCK FB_Menu&lt;/span&gt;
&lt;span class="err"&gt;PROPERTY Var1 : BOOL&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;then in visu&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;VAR&lt;/span&gt;
&lt;span class="err"&gt;    fb:     FB_Menu:= (Var1:= TRUE);&lt;/span&gt;
&lt;span class="err"&gt;END_VAR&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</summary></entry><entry><title>Init for visualization owned fb</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/?limit=25#59b8" rel="alternate"/><published>2022-08-31T23:17:49.617000Z</published><updated>2022-08-31T23:17:49.617000Z</updated><author><name>thecolonel26</name><uri>https://forge.codesys.com/u/thecolonel26/</uri></author><id>https://forge.codesys.coma155530d7c480d3ea685d609ae0f38f15f8e375d</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Question: Are you expecting a separate instance of the Function Block for each client that connect to the WebVisu server?&lt;br/&gt;
If yes then it is a little more complicated&lt;/p&gt;
&lt;p&gt;if no...&lt;/p&gt;
&lt;p&gt;The best way, I have found to handle things, is to have a Function Block defined for each Visualization you have defined. this function Block serves as the "View Model"&lt;/p&gt;
&lt;p&gt;So like the Main Visualization has a viewModel and it is a reference to an instance in the process code. Because it is in the process code FB_init is called.&lt;/p&gt;
&lt;p&gt;Then that main ViewModel, has a viewmodel for each of the visualizations that will be changed in the main Frame, those viewmodels for each screen are then injected in to those visualization with a VAR_IN_OUT. And you can keep doing that and build layers.&lt;/p&gt;
&lt;p&gt;since all of it is in side the Main ViewModel FunctionBlock and that is a reference to an instance in the process code, all of the init code functions normally.&lt;/p&gt;
&lt;p&gt;It's not a great solution but it works. If you want a better solution go find the Codesys Product Owners on LinkedIn and demand better features.&lt;/p&gt;
&lt;p&gt;this is what I recently requested&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;FB/Class Property Support in CFC (you can't use Properties as Input or Outputs in CFC)&lt;/li&gt;
&lt;li&gt;Method/function Pointers (or C# Style delegates), this would be very helpful in Visualization code; it would make UI code so much more structured and reusable.&lt;/li&gt;
&lt;li&gt;Interface Implementation Methods should not incorrectly throw a C0149 when the Interface only uses a Get, but the implementation has a GET and SET. Using an interface to Mask write access is a perfectly valid OOP technique.&lt;/li&gt;
&lt;li&gt;Each user-created visualization instance should have its own VAR instances instead of them being static (shared by all client sessions)&lt;/li&gt;
&lt;li&gt;Visualizations should have anchor properties like WPF and WinForms so you can tell set them to move with the bottom or right side of the frame or set them to stretch with the right side or bottom of the frame.&lt;/li&gt;
&lt;li&gt;Visualization Table "Use Template" needs to allow user-created visualizations.&lt;/li&gt;
&lt;li&gt;Visualizations need a FlowLayoutPanel/WrapPanel that allows a user-created visualization to be used as a template, just like I mentioned for tables.&lt;/li&gt;
&lt;li&gt;Visualizations should allow Methods to be defined in them and to be debugged so that visualization/UI-related code can be encapsulated in the visualization where it belongs and not in the control/operations code.&lt;/li&gt;
&lt;li&gt;Better error messages when errors occur during application download and initialization.&lt;/li&gt;
&lt;li&gt;
&lt;ul&gt;
&lt;li&gt;Messages like "&lt;em&gt;Exception&lt;/em&gt; &lt;span&gt;[GlobalInit]&lt;/span&gt; Code: App=&lt;span&gt;[Application]&lt;/span&gt;, Exception=&lt;span&gt;[Access Violation]&lt;/span&gt;" are not exactly helpful that tell me nothing about where or what is causing the access violation. This could be anywhere.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Ability to set breakpoints in initialization code before download, so that code that is executed during the initialization step can be debugged. &lt;/li&gt;
&lt;li&gt;Automatic FB property implementations with implicit backing fields like C#, so you do not have to write so much boilerplate code (this should be allowed to be overridden, though)&lt;/li&gt;
&lt;li&gt;Real Generics like in C#&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</summary></entry><entry><title>Init for visualization owned fb</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/?limit=25#17a5" rel="alternate"/><published>2022-08-04T10:18:41.701000Z</published><updated>2022-08-04T10:18:41.701000Z</updated><author><name>smartcoco</name><uri>https://forge.codesys.com/u/smartcoco/</uri></author><id>https://forge.codesys.com335751c6e2de70e6f9e1bded44a53da95300fee3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I'm looking for the same solution&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Init for visualization owned fb</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/1c6e3e195b/?limit=50#807e" rel="alternate"/><published>2021-04-08T08:57:55.375000Z</published><updated>2021-04-08T08:57:55.375000Z</updated><author><name>ludecus</name><uri>https://forge.codesys.com/u/ludecus/</uri></author><id>https://forge.codesys.com80b54afa970df859359bc711114dc835a25d7652</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I did search for any solutions of my issue, but i am not happy with the results.&lt;/p&gt;
&lt;p&gt;The issue:&lt;br/&gt;
We use function blocks instances within a visualization. For the first time the frame is called, we would like to initialize some values or references.&lt;/p&gt;
&lt;p&gt;We typically use pragmas like call_after_init or the FB_Init method. Unfortunately these don't work in the visualization.&lt;/p&gt;
&lt;p&gt;Is there any way for?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>