<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Opening a Dialog on a specific Client from ST</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/5763fc6a4a/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Visualization/thread/5763fc6a4a/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Visualization/thread/5763fc6a4a/</id><updated>2024-11-05T01:05:31.640000Z</updated><subtitle>Recent posts to Opening a Dialog on a specific Client from ST</subtitle><entry><title>Opening a Dialog on a specific Client from ST</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/5763fc6a4a/?limit=25#f492" rel="alternate"/><published>2024-11-05T01:05:31.640000Z</published><updated>2024-11-05T01:05:31.640000Z</updated><author><name>warrumungi</name><uri>https://forge.codesys.com/u/warrumungi/</uri></author><id>https://forge.codesys.com43300fcbd05c425ac9fe03a34fe5f5c0d6296f77</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi &lt;/p&gt;
&lt;p&gt;Thanks, Manuel, for providing this solution and insight. I too had &lt;em&gt;exactly&lt;/em&gt; the same problem as you did. While I did implement a custom filter, I'd also like to point out what jinlee mentioned above...I see no reference to VU.PublicVariables.Clients.Current anywhere?? In my case I only needed to show a dialog on a "master" client, not all the clients, so I filtered by IP address to do this.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Opening a Dialog on a specific Client from ST</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/5763fc6a4a/?limit=25#6ec8" rel="alternate"/><published>2024-02-08T10:18:09.783000Z</published><updated>2024-02-08T10:18:09.783000Z</updated><author><name>jinlee</name><uri>https://forge.codesys.com/u/jinlee/</uri></author><id>https://forge.codesys.com2d3ece3bf22bd3a981eb643cf88dd2b5e8e112db</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi, &lt;br/&gt;
for this, G_LastClient := VU.PublicVariables.Clients.Current; &lt;/p&gt;
&lt;p&gt;It fails to do it. &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Opening a Dialog on a specific Client from ST</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/5763fc6a4a/?limit=25#c104" rel="alternate"/><published>2023-09-27T05:47:57.525000Z</published><updated>2023-09-27T05:47:57.525000Z</updated><author><name>manuknecht</name><uri>https://forge.codesys.com/u/manuknecht/</uri></author><id>https://forge.codesys.comc5388aa4f58aa5f6e5c436744f2eadb7cb2ea7b8</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I managed to find a solution that seems to work reliably. As the &lt;em&gt;VU.Globals.CurrentClient&lt;/em&gt;-filter accesses the &lt;em&gt;CURRENTCLIENTID&lt;/em&gt; or at least a similar, internal variable it can only be used if called from a certain client (e.g. from a button in a visualization). My solution works by implementing a new client filter that compares the client ID of all clients to the ID of the last client that was used. The variable containing the data of the last client is defined as:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;G_LastClient&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;VU&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;IVisualizationClient&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;// Copy of last client that detected click&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This last client is then updated every time a button is pressed using the &lt;em&gt;Execute ST-Code&lt;/em&gt; input configuration of the button:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;G_LastClient&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;VU&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;PublicVariables&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;Clients&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nv"&gt;Current&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Next, I created a function block that implements the client filter interface as so:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;FUNCTION_BLOCK&lt;/span&gt; &lt;span class="n"&gt;FB_LastClientFilter&lt;/span&gt; &lt;span class="n"&gt;IMPLEMENTS&lt;/span&gt; &lt;span class="n"&gt;VU&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IVisualizationClientFilter&lt;/span&gt;
&lt;span class="n"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="n"&gt;VAR_OUTPUT&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;span class="kr"&gt;VAR&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then i added a method to the FB called &lt;em&gt;IsAccepted&lt;/em&gt; which is used to filter out the client. When creating the method, it should automatically be filled with the according variable declaration, as it is defined in the interface:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;For&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;every&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;client&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;can&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;be&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;desided&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;it&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;accepted&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n n-Quoted"&gt;``&lt;/span&gt;&lt;span class="no"&gt;TRUE&lt;/span&gt;&lt;span class="n n-Quoted"&gt;``&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;Client&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;is&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;accepted&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;METHOD&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;IsAccepted&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;BOOL&lt;/span&gt;
&lt;span class="n"&gt;VAR_INPUT&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;The&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;client&lt;/span&gt;&lt;span class="p"&gt;,&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="k"&gt;check&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;itfClient&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;VU&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IVisualizationClient&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_VAR&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now the client can be compared to the last used client as such:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;// check if clientID corresponds to clientID of last recorderd client&lt;/span&gt;
&lt;span class="n"&gt;IF&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;itfCLient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ClientId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;G_LastClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ClientId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;THEN&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;IsAccepted&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;TRUE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;ELSE&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="n"&gt;IsAccepted&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;FALSE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;END_IF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;To make use of this custom client filter, initialize a variable with the client filter:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;LastClient&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;FB_LastClientFilter&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;// Client filter to find last used client&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then use this client filter when opening or closing a dialog from ST:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;fbOpenMyDialog&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;itfClientFilter&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;LastClient&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;xExecute&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;sDialogName&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="s1"&gt;'VIS_MyDialog_DLG'&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</summary></entry><entry><title>Opening a Dialog on a specific Client from ST</title><link href="https://forge.codesys.com/forge/talk/Visualization/thread/5763fc6a4a/?limit=25#a98f" rel="alternate"/><published>2023-08-11T06:52:17.355000Z</published><updated>2023-08-11T06:52:17.355000Z</updated><author><name>manuknecht</name><uri>https://forge.codesys.com/u/manuknecht/</uri></author><id>https://forge.codesys.come504c8af82eadaf72232457334aabc574975ddc2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I would like the following to happen: Upon pressing a button, one of several dialogs shall be opened, depending on the state of other variables. I managed to realize this by either using the "Execute ST-Code" Option in the Input Configuration or by setting a BOOL Variable on button tap and executing the same code elsewhere. The code is something like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nt"&gt;CASE&lt;/span&gt; &lt;span class="nt"&gt;eCmdType&lt;/span&gt; &lt;span class="nt"&gt;OF&lt;/span&gt;
    &lt;span class="nt"&gt;E_COMMAND_TYPE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;E_MOTION&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="nt"&gt;fbOpenMotionDialog&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;itfClientFilter&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;VU&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Globals&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CurrentClient&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;xExecute&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;sDialogName&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="s1"&gt;'VIS_InsertMotion_DLG'&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="nt"&gt;E_COMMAND_TYPE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;E_WAIT&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
        &lt;span class="nt"&gt;fbOpenWaitTimeDialog&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;itfClientFilter&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;VU&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Globals&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CurrentClient&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;xExecute&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nt"&gt;sDialogName&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="s1"&gt;'VIS_InsertWaitTime_DLG'&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nt"&gt;END_CASE&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;When using the client filter "AllClients", and using several visualizations, the dialog stays open on other visus, which is undesired. Using the option "CurrentClient" is what I am looking for, however it only works when being called in the "Execute ST-Code" section of the button.&lt;/p&gt;
&lt;p&gt;How can I record on which Visu a button was pressed and open a Dialog only in the regarding Visu? I tried creating a variable of type VU.IVisualizationClientFilter and setting it to VU.Globals.CurrentClient in the Input Configuration of the button, but that does not seem to work.&lt;/p&gt;
&lt;p&gt;Would appreciate any ideas!&lt;/p&gt;
&lt;p&gt;Cheers&lt;br/&gt;
Manuel&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>