Showing results 1 to 7 of 7

Thread: LeftClickUp VBA, to LeftClickUp VSTA

  1. #1
    Join Date
    28.08.2009
    Posts
    26

    Frage LeftClickUp VBA, to LeftClickUp VSTA

    Hello,
    Is it possible to use VSTA as Element LeftClickUp or enother Mouse event handler as we use VBA macros Element Module Element. I want to execute VSTA functions on LeftclickUp.

    Maybe somebody has examples how to use Mouse event handler on element VBA Leftclickup.

    Thanks

  2. #2

    Default Re: LeftClickUp VBA, to LeftClickUp VSTA

    Unfortunately that is not possible at the moment.

    A similar functionality for VSTA to the VBA element object mouse events however, is suggested to be implemented in a future version for zenon.

  3. #3

    Default Re: LeftClickUp VBA, to LeftClickUp VSTA

    Quote Originally Posted by markclemens View Post
    Unfortunately that is not possible at the moment.

    A similar functionality for VSTA to the VBA element object mouse events however, is suggested to be implemented in a future version for zenon.
    Hello,

    Do you know if the events in VBA has included to the VSTA? Or in which version will they be implemented?
    I am looking for a way to use zAml_AlarmListSelectionChanged ..

  4. #4

    Default Re: LeftClickUp VBA, to LeftClickUp VSTA

    Hi yavaskoray,

    The event AlarmListSelectionChanged is available in VSTA.

    Also since the original post, new events for DynPictures have beem implemented in VSTA to be able to react e.g. on a left click on an element in a screen.

    For more information, see the online help, chapter "programming interface".

    Best regards,
    Mark

  5. #5
    Join Date
    20.08.2009
    Posts
    293

    Default AW: LeftClickUp VBA, to LeftClickUp VSTA

    Hi,

    here is some code how which uses these VSTA Events (ButtonUp & ButtonDown), the other events are easy to implement.

    The code writes CEL messages with the element name when pressing/releasing zenon elements via left/right mouse button.

       public partial class ThisProject
        {
            zenOn.IDynPictures zDynPictureEvents;
    
            private void ThisProject_Startup(object sender, EventArgs e)
            {
                this.Project.Active += new zenOn.ActiveEventHandler(Project_Active);
                this.Project.Inactive += new zenOn.InactiveEventHandler(Project_Inactive);
    
            }
    
            void Project_Active()
            {
                zDynPictureEvents = this.DynPictures();
                zDynPictureEvents.ElementLeftButtonDown += new zenOn.ElementLeftButtonDownEventHandler(zDynPictureEvents_ElementLeftButtonDown);
                zDynPictureEvents.ElementLeftButtonUp += new zenOn.ElementLeftButtonUpEventHandler(zDynPictureEvents_ElementLeftButtonUp);
                zDynPictureEvents.ElementRightButtonUp += new zenOn.ElementRightButtonUpEventHandler(zDynPictureEvents_ElementRightButtonUp);
                zDynPictureEvents.ElementRightButtonDown += new zenOn.ElementRightButtonDownEventHandler(zDynPictureEvents_ElementRightButtonDown);
            }
    
    
            void zDynPictureEvents_ElementLeftButtonUp(zenOn.IDynPicture obDynPicture, zenOn.IElement obElement, int lPosX, int lPosY, int lButton)
            {
                this.Cel().WriteCelString("LeftButtonUp - " + obElement.Name);
                
            }
    
            void zDynPictureEvents_ElementLeftButtonDown(zenOn.IDynPicture obDynPicture, zenOn.IElement obElement, int lPosX, int lPosY, int lButton)
            {
                this.Cel().WriteCelString("LeftButtonDown - " + obElement.Name);            
            }
                  
    
            void zDynPictureEvents_ElementRightButtonUp(zenOn.IDynPicture obDynPicture, zenOn.IElement obElement, int lPosX, int lPosY, int lButton)
            {
                this.Cel().WriteCelString("RightButtonUp - " + obElement.Name);
               
            }
    
            void zDynPictureEvents_ElementRightButtonDown(zenOn.IDynPicture obDynPicture, zenOn.IElement obElement, int lPosX, int lPosY, int lButton)
            {
                this.Cel().WriteCelString("RightButtonDown - " + obElement.Name);           
            }      
                
    
            void Project_Inactive()
            {
                zDynPictureEvents.ElementLeftButtonUp -= new zenOn.ElementLeftButtonUpEventHandler(zDynPictureEvents_ElementLeftButtonUp);
                zDynPictureEvents.ElementLeftButtonDown -= new zenOn.ElementLeftButtonDownEventHandler(zDynPictureEvents_ElementLeftButtonDown);
                zDynPictureEvents.ElementRightButtonUp -= new zenOn.ElementRightButtonUpEventHandler(zDynPictureEvents_ElementRightButtonUp);
                zDynPictureEvents.ElementRightButtonDown -= new zenOn.ElementRightButtonDownEventHandler(zDynPictureEvents_ElementRightButtonDown);
                zDynPictureEvents = null;
            }
            
            private void ThisProject_Shutdown(object sender, EventArgs e)
            {
                this.Project.Active -= new zenOn.ActiveEventHandler(Project_Active);
                this.Project.Inactive -= new zenOn.InactiveEventHandler(Project_Inactive);
            }
    
            #region VSTA generated code
            private void InternalStartup()
            {
                this.Startup += new System.EventHandler(ThisProject_Startup);
                this.Shutdown += new System.EventHandler(ThisProject_Shutdown);
            }
            #endregion
        }

    Regards,
    Bernhard
    Last edited by bernhardf : 24th July 2013 at 07:14

  6. #6

    Default Re: AW: LeftClickUp VBA, to LeftClickUp VSTA

    Perfect! Thank you all!

  7. #7
    Join Date
    11.04.2008
    Posts
    40

    Default Re: AW: LeftClickUp VBA, to LeftClickUp VSTA

    Hi,

    Is it possible to have the code in VB.Net please, I have tried converting it but failed.

Similar Threads

  1. Einstieg in VSTA C#
    By manfred_fh in forum VSTA
    Replies: 2
    Last Post: 8th November 2010, 20:24
  2. Replies: 5
    Last Post: 14th September 2010, 12:53
  3. VSTA Startproblem
    By stimpfig in forum VSTA
    Replies: 4
    Last Post: 23rd February 2010, 15:47

Posting Rules

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