Graphic Variable AnimatedCurrentValue as VBA object

Hello,

I am trying to build a custom VBA form to use with a custom menu system we are developing.  The menu system graphic is designed to have many layers (units) with multiple links per unit.  The front-end I'm developing allows the graphics developer to easily configure the display name for the graphic as well as the actual graphic to be called up.  In the image below, clicking on the unit name on the left changes the links available on the right.

The method we are using to store all of this information are a set of string variables on the graphic that have text animation (AnimatedCurrentValue).  The source is tied to the internal (to the graphic) unit number that is selected.  

When the graphic is edited, I pass the whole graphic as an object to an intermediary function.  The intermediary function's job is to open the form and execute the PopulateForm() method.  This is very similar to how the dynamo editing functions work, except that they pass the dynamo as an object instead.

The challenge I run into is this:  I am not able to read the table values of the variables AnimatedCurrentValue animation from the form.  Let me explain further.  For tables of this nature, Books-On-Line indicates that there are some methods available for manipulating them:

1. AddLevel (Index, Input, Output, ... Outputx)
2. GetLevel (Index, Input, Output1, ... Outputx)
3. RemoveAllLevels
4. RemoveLevel

If I set up some VBA on the menu graphic itself, I can execute the following (the variables name is t_Table and the animation name is AnimatedCurrentValue):

'Edit function
Private Sub cmdEdit_Edit()

     Dim obj As Object
     Dim Input1, Output1, Output2, Output3 As String

     Set obj = frsFindLocObj(t_Table, "AnimatedCurrentValue")
     obj.GetLevel 2, Input1, Output1, Output2, Output3

     Debug.Print Input1 & ", " & Output1 & ", " & Output2 & ", " & Output3

End Sub

The result I receive is what I expect it to be (for some reason I have to query extra outputs to get the two values):

1, Value 1, , 

When I try to move this logic to the form, the code changes slightly: I have to acquire the variable object first followed by the animation object.  This seems to be no problem.  

'Sub to populate the form
Public Sub PopulateForm()
    On Error GoTo ErrHandler

    Dim tIndex As Integer
    Dim tInput As String
    Dim tOutput1 As String
    Dim tOutput2, tOutput3 As String
    Dim result As Variant

    'Note objGraphic is the name of the graphic object global variable

    Dim objGeneric As Object
    Dim objAnimation As Object

    Set objGeneric = Nothing
    Set objAnimation = Nothing
    Set objGeneric = frsFindLocObj(objGraphic, "t_Table")
    Set objAnimation = frsFindLocObj(objGeneric, "AnimatedCurrentValue")

    'Get the row data from the table (row index, comparison val, output vals 1 to x)
    objAnimation.GetLevel 1, tInput, tOutput1, tOutput2, tOutput3

    'Add a row to the table (row index, comparison val, output val)
    objAnimation.AddLevel 8, "Level 8"

End Sub

However, I cannot read the values out of the table. The strange thing though, is that I can add values to the table!  I am able to read/write to variables at the top level of the graphic, but once I drill down into them I lose it.

How can I add values to this table, but not read them?  Can anyone see what I am missing here? 

Thank you,

Dave

  • So to make sure I understand, the "GetLevel" portion of the code is not returning values? Have you tried changing the parameter types to variants. I believe that is what the function is expecting and what I've used in the past. I wouldn't think it would matter but it's a quick thing to try.