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?