Showing results 1 to 2 of 2

Thread: How can I get an element at VSTA Runtime?

  1. #1
    Join Date
    16.03.2017
    Posts
    6

    Default How can I get an element at VSTA Runtime?

    In VSTA Workspace, I can get static text property.
    like this:


    [System.AddIn.AddIn("MyWorkspace", Version = "1.0", Publisher = "", Description = "")]


    ...
    zenOn.IDynPicture scr = this.ActiveDocument.DynPictures().Item("Dashboard");
    zenOn.IElement Text = scr.Elements().Item("Static text_1_2");
    string textProp = (Text.get_DynProperties("Text")).ToString();


    ...




    BUT, how can I get static text property at RunTime(Project VSTA)?
    The below code throw exception: textProp is null


    [System.AddIn.AddIn("ThisProject", Version = "1.0", Publisher = "", Description = "")]


    ...
    zenOn.IDynPicture screen = this.DynPictures().Item("Dashboard");
    zenOn.IElement text = screen.Elements().Item("Static text_1_2");
    string textProp = (text.get_DynProperties("Text")).ToString();


    OR, Could I use "this.ActiveDocument" at runtime VSTA?

    Thanks.
    Last edited by monad : 17th March 2017 at 07:55

  2. #2
    Join Date
    03.11.2015
    Posts
    39
    Best Answer

    Default Re: How can I get an element at VSTA Runtime?

    Hi Monad,

    please note that there are quite many DynamicProperties which can only be modified/adjusted in the editor but not during the runtime.
    If you debug through your code, do you get the correct text-instance back? If this is the case, the text property might not be available in the runtime.

Similar Threads

  1. How can I use element in VSTA?
    By youngseolwha in forum VSTA
    Replies: 0
    Last Post: 7th March 2016, 08:14
  2. Replies: 3
    Last Post: 23rd October 2013, 17:10
  3. Movable element in Runtime
    By focus in forum zenon Supervisor
    Replies: 12
    Last Post: 7th February 2012, 09:48
  4. Replies: 1
    Last Post: 19th January 2012, 00:01
  5. Replies: 1
    Last Post: 2nd December 2008, 11:07

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
  •