Showing results 1 to 6 of 6

Thread: Popup variables

  1. #1
    dietersar Gast

    Default Popup variables

    I'm using the same popup picture for the same function with different variables. Depending on the passed variables on the popup, I'll have to do something with them.
    How can I get the variable names from the popup picture and how can I get the name of the calling function in VBA?

    Thanks.

  2. #2

    Default Re: Popup variables

    I'm not 100% sure what you mean.

    If you have a function which calls a pciture and substitutes the variables in the picture with other variables, by means of replacing variables or functions hard-coded, you can access the Dynproperties "PictSwitch.SubstiVar[0].Source" and "PictSwitch.SubstiVar[0].Destination" in VBA.

    If you are using the replace indices functionality, you can get the variable object of the first index variable through the Dynproperties "PictSwitch.IndexVar[0].Title"

    The replace string for replacing indices can be read through the DynProperties "PictSwitch.IndexSubstitution[0].Source" and "PictSwitch.IndexSubstitution[0].Destination"

    Note, that e.g. "PictSwitch.SubstiVar[-1].Source" returns the amount of variables in the substitution, so you can build e.g. a For Next loop.

    ---
    regarding the function, you could instead of the function, execute a VBA macro, which, depending on the name of the button, executes a specific function.


    -----
    If you tell me more about what exactly it is that you want to achieve, I might be able to provide another, more effective solution

  3. #3
    Join Date
    24.04.2012
    Posts
    17

    Beitrag Re: Popup variables

    Dear Mark,
    i try to create a function using VBA with indexing method.

    here my cade is

    Private Sub GetorCreateFunction()
        Dim FunctionName As String
        Dim Rtfn As RtFunction
        Dim PictureName As String
    
        
        FunctionName = "testfn"
        PictureName = "1CM_01_Win_3S_BS"
        
        Set Rtfn = thisProject.RtFunctions.Item(FunctionName)
        If Rtfn Is Nothing Then
            Set Rtfn = thisProject.RtFunctions.Create(FunctionName, tpPicture)
        End If
        With Rtfn
            .DynProperties("PictSwitch.Picture") = PictureName
            .DynProperties("PictSwitch.IndexVar[0].Title") = "0ST_Win_3S_BS_Sts1_Indx"
            .DynProperties("PictSwitch.IndexSubstitution[0].Source") = "sys_Win_3S_BS_Sts1"
            .DynProperties("PictSwitch.IndexSubstitution[0].Destination") = "{X01}"
        End With
    End Sub

    this script is creating only the function with out indexing.
    i'm using Zenon7.0

    kindly check and do the needful
    Last edited by paruvathakumar : 28th February 2013 at 11:44
    Thanks&Rgds,
    Paruvathakumar

  4. #4
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    881

    Default Re: Popup variables

    qoute:
    Set Rtfn = thisProject.RtFunctions.Create(FunctionName, tpPicture)


    you can not create functions, screens, elements, ... in the zenon runtime

    you can modify existing functions within the zenon runtime via vba/vsta before executing

    regards,
    herbert

  5. #5
    Join Date
    24.04.2012
    Posts
    17

    Default Re: Popup variables

    i'm executing the above function in Editor only.
    the above script is creating the RtFunction with out indexing.
    Thanks&Rgds,
    Paruvathakumar

  6. #6
    Join Date
    30.05.2007
    Location
    Salzburg
    Posts
    881

    Default Re: Popup variables

    thisproject = VBA code within the project for the zenon Runtime

    MyWorkspace = zenon Editor


    Please check the help documentation at
    Manual -> Programming interfaces -> Object model -> RtFunction
    -> at the bottom of that page you can find an example how to modify an existing function within the zenon Runtime


    Manual -> Programming interfaces -> Object model -> RtFunctions
    -> examples which show how to create functions via VBA in the zenon Editor

Similar Threads

  1. Replies: 2
    Last Post: 17th December 2008, 09:09
  2. Replies: 1
    Last Post: 17th December 2008, 09:07
  3. PLC Variables and Internal Variables
    By madphilly in forum Drivers
    Replies: 1
    Last Post: 4th June 2008, 06:59

Posting Rules

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