Back

Topic

[KB607]Managing VBA events when a mimic object overlaps a template object

Tags: Mimic, Scripting, VBA

13 years ago
By RM
Options
Print
Applies to:

PcVue all versions.
PlantVue all versions.
FrontVue all versions.


Summary:

This article explains the options for managing VBA events when a mimic template object and a mimic object overlap.


Details:

A reminder

By default, when using a mimic template, mouse actions (eg, click) are treated first by the template. For example if you have overlapping buttons with command type animations, one in the template and one in the mimic,  when you click in the common area the command in the mimic template will be executed.
This can be changed by using the option Priority to mimic commands in the mimic properties dialog (Template tab). But this affects command animations only and not VBA.

The problem

You want to run a VBA precudure on a mouse click of a drawing object from both the mimic template and mimic. The objects overlap and you want the mimic to have priority so that if the common area is clicked the mimic VBA procedure runs.

The solution

Run the VBA procedures, for both template and mimic objects, using the Execute Procedure animation instead of directly from the mouse event generated by the object. You must also select the option Priority to mimic commands.

Other potential problems

If you were running a VBA procedure directly from a mouse event on a drawing object in a template, but have subsequently removed it, the property Enable events will probably still be set to true. This will give the template object’s events priority even though there is no longer an associated VBA procedure. In this case, after removing the VBA procedure, also make sure that you set Enable events to false.

 


Created on: 20 Nov 2012 Last update: 13 May 2024