Showing results 1 to 5 of 5

Thread: My workspace Macros?

  1. #1
    Join Date
    28.08.2009
    Posts
    26

    Default My workspace Macros?

    Hi all,
    I am newbie in C#.
    How to access to Macros that exist in MyWorkspace.
    Now I can access only ThisProject.cs Macros.
    If I wrote code in ThisProject I can access to it via Execute VSTA macro. But if Macro exist in MyWokspace.cs I can't accessto it.

    How to access this.ActiveDocument. in Project.cs

    Thanks

  2. #2

    Default Re: My workspace Macros?

    unlike VBA where there is one IDE for both the workspace and the project in the runtime, seperate VSTA workspaces exist for the workspace (editor) and the project (runtime)

    To call the VSTA IDE with the workspace addin, you can select the option "open VSTA editor" from the "File" menu, or you can press "Alt+F10" in the editor.

    The VSTA IDE for the project addin is called in the context menu for the project tree node "programming interface".

    The context menu incorrectly states "Alt+F10" as a keyboard shortcut, which is not true.

    At the moment there is no keyboard shortcut to call the project addin for the active project, however this may be implemented in a future version.



    After you have created your public void "Macroxxx" (must be public, and start with "Macro") in the workspace addin, and have compiled your workspace addin, you should be able to start your VSTA macros from the VBA Macro toolbar in the editor.

  3. #3
    Join Date
    28.08.2009
    Posts
    26

    Unglücklich Re: My workspace Macros?

    Thanks

    I have two files ThisProject.cs and Forma.cs
    In forma i Add ListBox1 and I want to access to it's method Listbox.Items.Add(myVariable.tagName) from thisProject;
    MyVariable is declared as public

    In ThisProject i Use
    myVariables = this.Variables
    for (int = 0;i {
    myVariable = myVariables().Item(i);
    messageBox.Show(myVariable.Tagname) // here I want to access to Forma Listbox1

    }

    Question How to access to listbox1 which exist in Forma.cs
    How to access to Forma I know

    Forma MyForma = new Forma();
    MyForma.Show();
    I want to access to MyForma.ListBox1.Items.Add(myVariable.Tagname);

    How I can do that?

    Thanks a lot.
    Maybe is a stupid question but I can't find answer

  4. #4
    Join Date
    28.08.2009
    Posts
    26

    Default Re: My workspace Macros?

    I found sollution

    Forma MyForma = new Forma(this.Project);
    MyForma.Show();

    We need to override form1 construkctor with one parameter

    thans for answers

  5. #5

    Default Re: My workspace Macros?

    You have to be careful with multi-threading and passing a zenon object from the main thread into the thread that holds your form. It is better to pass an array with the variable identifications than the zenon project object, and access the zenon object properties in the other thread.

Similar Threads

  1. Workspace backup error
    By skywalker in forum zenon Operator
    Replies: 1
    Last Post: 17th August 2010, 00:59
  2. Empty Workspace
    By bernhardf in forum zenon Supervisor
    Replies: 0
    Last Post: 20th May 2010, 13:54

Posting Rules

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