Showing results 1 to 3 of 3

Thread: Creating a DynText element by macro

  1. #1
    Join Date
    22.04.2021
    Posts
    7

    Default Creating a DynText element by macro

    Hi, 
    I have a problem with metodh Create. I would like to display a variable name by using macro with mouseover events.
    Now i added a "Dynamic Text" element to one screen and it works, but i would like to use that functionality to all screens. I'm trying to create a dynamic text elements automatically, but it does not work. I guess i have problem with good path to that element. I attached code below.

    Public Sub MouseOver_Default(obElem As Element, vPosX As Variant, vPosY As Variant)
    'tworzenie dynamic textu na kazdym ekranie jak uzyte macro
    Const strName As String = "Dynamics_text_3"
    Dim zElement As Element
    Dim zElements As Elements
    'Dim zPIC As DynPicture

    'Set zElement = thisProject.DynPictures.Item(bsName)
    'Set zPIC = thisProject.DynPictures.Item("START")
    'If PIC Is Nothing Then Exit Sub
    If zElements Is Nothing Then
    Set zElement = thisProject.DynPictures.Elements.Create(strName, tpDynText)


    'creating dyntext element
    'Set zElement = zElement.Elements.Create(bsName, tpText)
    With zElement
    .Width = 300
    .Hight = 50
    .Left = -100
    .Top = -25
    .VisibilityVariable = "widocznosc"
    .XVariable = "dx"
    .XVarMax = 1950
    .XViewMax = 1950
    .XVarMin = 0
    .XViewMin = 0
    .YVariable = "dy"
    .YVarMax = 950
    .YViewMax = 950
    .YVarMin = 0
    .YViewMin = 0
    .DynProperties("Text1") = "nazwy_zmiennej_off_on"

    End With
    End If


    'zmienne do sciezki
    Dim zVariables As Variables
    Dim zVariable As Variable
    Set zVariables = thisProject.Variables
    'zmienne pozycji myszki
    Dim zmiennax As Integer
    Dim zmiennay As Integer
    'stale
    Const t = True
    'zmienne pozycji okienka
    Dim dx As Variable
    Dim dy As Variable
    'zmienna dotycznca widocznosci i wlaczanie
    Dim widocznosc As Variable
    Dim on_off As Variable
    'nazwa najechaniej zmiennej
    Dim nazwazmiennej As Variable
    'wlaczenie i wylaczenie funkcji odczytu
    Set on_off = zVariables.Item("nazwy_zmiennej_off_on")
    'If on_off.Value = t Then

    'przypisanie wynikow funkcji do zmiennych wspolrzedne myszki
    zmiennax = CInt(vPosX)
    zmiennay = CInt(vPosY)


    Set widocznosc = zVariables.Item("widocznosc")
    widocznosc.Value = on_off.Value

    'przypisanie nazwy zmiennej do okienka na ekranie
    Set nazwazmiennej = zVariables.Item("nazwazmiennej")
    nazwazmiennej.Value = obElem.ItemVariable(0).Name

    'polozenie okeinka wzgledem myszki
    Set dx = zVariables.Item("dx")
    dx.Value = zmiennax + 50
    Set dy = zVariables.Item("dy")
    dy.Value = zmiennay + 50

    'End If

    End Sub


    What is the correct way to create dynamic text element?



  2. #2
    Join Date
    18.12.2017
    Posts
    44

    Default Re: Creating a DynText element by macro

    Hi!

    You cant create an element in Runtime:



    If you want to display a variable name in the Runtime, you can just right click on the variable.



    If you still want to use a macro, the text element must exist when starting Runtime.
    You can, for example, show the value of a string variable and set the string to the name of the variable you are clicking on.
    With a boolean variable, you can show/hide the element when not using it.

    /Fredrik

  3. #3
    Join Date
    21.07.2021
    Posts
    1

    Default Re: Creating a DynText element by macro

    Thanks a lot man!!! Because of your help, I was able to complete my work.
    Great thanks to you.

Similar Threads

  1. Creating all in to PDF
    By Srikanthg in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 26th July 2019, 10:20
  2. creating a table in zenon
    By lmucha in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 4
    Last Post: 1st June 2017, 10:31
  3. Replies: 5
    Last Post: 5th October 2012, 07:34
  4. Creating runtime files
    By scotttee in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 2
    Last Post: 22nd July 2009, 15:19
  5. Replies: 0
    Last Post: 5th January 2009, 15:13

Tags for this Thread

Posting Rules

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