Showing results 1 to 4 of 4

Thread: change linked variable of an element during runtime

  1. #1
    Join Date
    11.10.2013
    Posts
    2

    Default change linked variable of an element during runtime

    Hi,
    How can I change the linked variable of an element during run time using VB.net macro. I have something like this


    Private Sub zDynamicPicts_Open(ByVal obDynPicture As zenOn.IDynPicture) Handles zDynamicPicts.Open
    ' MsgBox(CStr(obDynPicture.Name))


    If obDynPicture.Name = "PopupScreen1" Then
    If lVar = "b1" Then
    For i As Integer = 0 To obDynPicture.Elements.Count - 1
    If obDynPicture.Elements.Item(i).Name = "Numerical value_1" Then
    obDynPicture.Elements.Item(i).set_DynProperties("variable", Me.Variables.Item("dnptest1"))
    End If
    Next
    End If
    End If
    End Sub

    My currently linked variable to the element is "test1". I want to replace it with "dnptest1"

  2. #2
    Join Date
    20.08.2009
    Posts
    293

    Default AW: change linked variable of an element during runtime

    Hi,

    it is not possible to directly exchange the linked variable of an element during the RT, but you could alter the substitution in the screen switch function to your process screen using vba in order to exchange the variable.

    Regards,
    Bernhard

  3. #3

    Default Re: change linked variable of an element during runtime

    Hi jainkuriakose,

    Thanks for your post, and welcome to the forum

    Substitution which Bernhard mentions is one option. Basically at the screen switch function to open the popup screen, you specify that "test1" should be replaced with "dnptest1". This information is then stored at the function. You can have multiple functions with different replacement, or substitution.

    Another method is to use something very similar, which is called "replace indices". Instead of a pre-configured replacement at the function in the editor, you configure a replacement that uses a variable value as a key for the replacement. So you would have one function, and one internal variable. At the function you configure "replace indices" to use the variable value.

    In the runtime you could then open the popup screen, and based on the variable value in the runtime, the variables in the popup screen would be different.

    You can find more information in the online help

    Best regards,
    Mark

  4. #4
    Join Date
    11.10.2013
    Posts
    2

    Default Re: change linked variable of an element during runtime

    Thanks! Both worked for me!!!

Similar Threads

  1. Minimal external variable change interval to be hooked in zenOn
    By stolyarov_as in forum zenon Supervisor
    Replies: 1
    Last Post: 24th September 2013, 18:38
  2. Movable element in Runtime
    By focus in forum zenon Supervisor
    Replies: 12
    Last Post: 7th February 2012, 09:48
  3. how to change driver in runtime
    By victoria in forum VBA
    Replies: 4
    Last Post: 11th October 2011, 23:32
  4. Store variable data to file on change event
    By matholton in forum Drivers
    Replies: 1
    Last Post: 1st December 2008, 10:40
  5. Change variable status
    By brada in forum VBA
    Replies: 5
    Last Post: 13th February 2008, 17:55

Posting Rules

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