Showing results 1 to 3 of 3

Thread: Access a Linked Variable on a Popup Screen

  1. #1
    Join Date
    21.09.2016
    Posts
    2

    Default Access a Linked Variable on a Popup Screen

    Hello,
    I am using VBA to write a variable "showblocking" which is linked to the visibility property in a red button on a popup screen.
    My popup has a tab selector, uses recipes and is called from two different places in my project, only one of this calls should be using this red button, the other should never show it.
    The porpuse of the button is to block the users from clicking another element in the popup. (I am already using authorization level on the rest of the buttons, so this is extra safety).
    I have 3 conditions to set that visibility variable "showblocking" to 1.
    1 Popup should have been called from screen FS01 (i have a way to know it)
    2 MUV.Permission bit is on (Bit comming from the PLC)
    3 PW_TabSelected is equal to 3

    Now, PW_Tab Selected is an internal variable aswell, but as it is used inside the popup i dont know if Zenon creates another instance (a copy of the variable) in orther to use it inside the popup, that way if i open one popup in the server and i open the same exact popup from the client the PW_TabSelected will be independant. (Which aparently works like that because there is no conflict between server and client using the same screen at the same time).

    So what i want is to say something like this
    If thisProject.DeviceName = "PT3P25_FS01" And thisProject.variables.Item("PW_TabSelected").Value = 3 Then
    If thisProject.variables.Item("MUV.Permission").Value = 1 Then
    thisProject.variables.Item("MUV.ShowBlocking_FS01").Value = 0
    Else
    thisProject.variables.Item("MUV.ShowBlocking_FS01").Value = 1
    End If
    Else
    thisProject.variables.Item("MUV.ShowBlocking_FS01").Value = 0
    End If

    Now the thing is, this code is working but only in the server and the standby server. The red button will never show if i am in the client.

    Hope you guys can help! Thanks

  2. #2
    Join Date
    21.09.2016
    Posts
    2

    Default Re: Access a Linked Variable on a Popup Screen

    One thing i tried is catching the PW_TabSelected variable value and assigned to a numeric value so i can see it on the popup.
    something like this
    thisProject.variables.Item("MUV.CurrentTab").Value = variables.Item("PW_TabSelected").Value

    The vaiable in my numerical value element on the screen is MUV.CurrentTab.
    And still if im runnin in any of the servers (Primary or Stand by) i can see the value changing everytime i change tabs in the popup (independently for both computers). But it will remain in 0 when i am running the client.

    I wonder if i can do something like this (I could not make it work):
    thisProject.variables.Item("MUV.CurrentTab").Value = thisProject.DynPictures.Item("Popup_FB_PT3P25_FS").Elements.Item("PW_TabSelected").Value

    just an example of what i think could work if i know how to set it up correctly and point it to the instance of PW_TabSelected created inside the popup.
    Last edited by kikonio2 : 22nd September 2016 at 15:32

  3. #3

    Default Re: Access a Linked Variable on a Popup Screen

    Hi kikonio2,

    Thanks for your posts and welcome to the forum

    The variable of the internal driver that you are using, has a property that defines if the variable is machine specific or globally available in the network.

    You probably want to take a look at that setting, because this could explain the difference in behavior on the server and the client.

    Also, to make your code more robust and have it survive possible errors, it is a good idea before reading a variable value, to check if the variable actually exists and in addition, if the variable value is valid. (.IsOnline returns true)

    I'm not 100% sure of what you are trying to achieve, but you may also want to take a look at the Network Authorization feature. Also, screen that is opened as a modal dialog, does not allow operation of other screens. Interlockings, another feature, may also be helpful with what you are trying to do.

    My experience is that it is always better to use standard functionality, than to try and program it yourself

    Best regards,
    Mark

Similar Threads

  1. Replies: 1
    Last Post: 24th June 2014, 19:51
  2. Access to Symbol in Full Screen mode
    By pilzfrance in forum zenon Supervisor
    Replies: 2
    Last Post: 26th February 2014, 15:30
  3. Replies: 3
    Last Post: 23rd October 2013, 17:10
  4. How to access linked symbol sub elements
    By carlo.chiari in forum VBA
    Replies: 6
    Last Post: 1st October 2012, 14:03
  5. Replies: 1
    Last Post: 17th December 2008, 09:07

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •