Shape Double Click

C

CyberBhai

Can anybody help me with an example of double click of shape ? I am uanble to
get any help on that.

Plz. Help
 
J

John

Each shape has a double click cell in its Shapesheet within the Events
section. A formula in that cell could be something simple like DoCmd(1312),
which would open the shape's custom properties dialog or any number of other
functions such a running a procedure (CallThis) or and add-on
(RUNADDON/WARGS). Have a look in help for the items in brackets.

Best regards

John
 
J

John Marshall, MVP

Here is some sample code for woring with Double Click

' Open the shape's Text
ActivePage.Shapes(1).CellsSRC(visSectionObject, visRowEvent,
visEvtCellDblClick).FormulaU = "OPENTEXTWIN()"

' Run a macro called Array Shapes...
ActivePage.Shapes(1).CellsSRC(visSectionObject, visRowEvent,
visEvtCellDblClick).FormulaU = "RUNADDON(""Array Shapes..."")"

'Open the shape's shapesheet
ActivePage.Shapes(1).CellsSRC(visSectionObject, visRowEvent,
visEvtCellDblClick).FormulaU = "OPENSHEETWIN()"

A simple trick to determine how to write VBA code is to turn on the Macro
Recorder and then perform the function or functions you want to translate
into code. There will be some cleanup required, but you will have the basic
code. There are some details on cleaning up the code at
http://msmvps.com/blogs/visio/archive/2006/03/03/85364.aspx

(The above examples were created using the Macro Recorder)

John... Visio MVP

Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm
Need VBA examples? http://www.mvps.org/visio/VBA.htm
Common Visio Questions http://www.mvps.org/visio/common_questions.htm
Visio Wishlist http://www.mvps.org/visio/wish_list.htm
 
A

Al Edlund

since your last post was about the activex control consider this

this from....

http://msdn.microsoft.com/office/un.../odc_vsprogrammingwithvisioactivexcontrol.asp



Use the Visio ShapeSheet® programmatically. The control does not provide
access to the Visio ShapeSheet user interface, which is a separate window in
the Visio application. However, the ShapeSheet itself still exists for the
Visio shapes and pages in the document loaded in the Visio drawing control.
You can still edit ShapeSheet cells for your Visio document in the control
using Visio Automation. For example, you can use the Cell object's SRC
property to add a double-click action for a Visio shape.

Note When you are programming the ShapeSheet for documents loaded in the
control, you will not be able to use the CALLTHIS function, which calls a
VBA macro in the document. The Visio drawing control does not execute VBA
code, so any use of the CALLTHIS function fails silently. Instead, you can
use the mouse events for the Visio Page and Document objects and handle the
event response in your custom container application logic. (For more
information about mouse events, see Handling Events.) If you are using a COM
add-in, you can also use the QUEUEMARKER function to queue a marker event on
the double-click event in the ShapeSheet.

http://msdn.microsoft.com/library/en-us/dnvisio02/html/vis_qmark.asp?frame=true#vis_qmark_topic4



Using the QueueMarkerEvent Add-on from a ShapeSheet Cell

To use the QueueMarkerEvent add-on from an Event or Action cell in the
ShapeSheet, specify the QueueMarkerEvent add-on and the solution-specific
context string in a formula as arguments to the RUNADDONWARGS function. For
example:

RUNADDONWARGS("QueueMarkerEvent", "/soln=CompanyName.Demo

/cmd=1")

Because the add-on is called from the ShapeSheet, Visio prepends information
to the command-line string passed to the add-on. That additional information
can be used to identify the shape, master, or style that contained the cell.
For example, if the preceding formula was contained in a shape with NameID
Sheet.1 on a page with index 1 in a document with index 1, then Visio would
prepend the following string to the command-line string passed to the
add-on:
 
C

CyberBhai

Al,
Thanx a lot for your response.
I have tried '=RUNADDONWARGS("winword.exe","abc.doc")' in 'EventDblClick',
but unable to get any output of that. But, if I put something like
'=HYPERLINK("http://www.yahoo.com")' works fine.

I am using Visio 2003.
 
C

CyberBhai

Al,
I need to execute an external application on double-click that happens on
the shape.

CyberBhai
 
M

Mark Nelson [MS]

Visio has removed or disabled many of the Shapesheet functions that launch
applications for security reasons. RUNADDON invokes an add-on that has been
registered with Visio.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

CyberBhai

Is there any means of running an external application on shape's double click ?

Cyberbhai
 
A

Al Edlund

yes, put a runaddon for the queue marker event into the shapesheet and then
capture the marker event in an external event processor.
al
 
A

Al Edlund

there are several examples in the visio sdk on how to create event
processors that are triggered by marker events from a document. Typically
though they are using persistent events in the template for things like
document opened.
al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top