<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to OOP: Change visualization and reference at runtime in program ST</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4f258337e2/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4f258337e2/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/4f258337e2/</id><updated>2023-05-31T08:31:44.263000Z</updated><subtitle>Recent posts to OOP: Change visualization and reference at runtime in program ST</subtitle><entry><title>OOP: Change visualization and reference at runtime in program ST</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4f258337e2/?limit=25#5450" rel="alternate"/><published>2023-05-31T08:31:44.263000Z</published><updated>2023-05-31T08:31:44.263000Z</updated><author><name>sbt-277</name><uri>https://forge.codesys.com/u/sbt-277/</uri></author><id>https://forge.codesys.com74750a978f3bd3603184781063a0500a15efef7b</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Lets say I have a navigation bar with three buttons where I want to change to a different visualization when the user clicks on one of the buttons. Each button/visualization could represent a settings visualization where the user can modify machine parameters.&lt;/p&gt;
&lt;p&gt;As I want to use object oriented programming I created different visualizations for each machine type. In the interface editor of each visualization I defined a VAR_IN_OUT custom variable with the custom data type of the machine like:&lt;/p&gt;
&lt;p&gt;Machine A:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Data&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MachineTypeA&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Machine B:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;Data&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MachineTypeB&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;and so one....&lt;/p&gt;
&lt;p&gt;Inside of the Data parameter (pointer to the instance of the MachineType) are all necessary parameters/data stored that are displayed and modified at the specific visualization that is presented to the user.&lt;/p&gt;
&lt;p&gt;Obviously I could have three times the same machine type or three different machine types (every machine type comes with its specific visualization and the already mentioned VAR_IN_OUT configuration). &lt;/p&gt;
&lt;p&gt;Now I'm looking for a way to change the displayed visualization or a visualization frame. If the user clicks on the first button the visualization for MachineTypeA should be displayed including the machine data which is passed over by the VAR_IN_OUT parameter. If the user clicks on the second button the visualization for MachineTypeB should be displayed including the machine data which is passed over by the VAR_IN_OUT parameter for MachineTypeB. &lt;/p&gt;
&lt;p&gt;I have an array with a pointer to each of the instances of the different machine types and a pointer to the VisuStructClientData ready to use. But now I'm lost in the visualization documentation and I can't figure out how to get it done.&lt;/p&gt;
&lt;p&gt;I discovered a method:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="err"&gt;VisuElems.VisuElemBase.g_VisuManager.SetMainVisu&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;But I think its not the right method because I can't see any possibility to pass the data to the VAR_IN_OUT parameter of the visualization. This seems to be a methode just to change the displayed visualization at runtime without changing the passed data set. But I can't predefine the reference date in the visualization editor because this would change when the user switches the displayed visualization.&lt;/p&gt;
&lt;p&gt;I hope someone understands my problem. &lt;/p&gt;&lt;/div&gt;</summary></entry></feed>