programming4us
 
Office
 

Developing Custom Microsoft Visio 2010 Solutions : Creating SmartShapes with the ShapeSheet (part 6) - Adding Right-Click Actions to the SmartShape

4/17/2014 1:54:09 AM

Adding Right-Click Actions to the SmartShape

The notes shape is still missing the two right-click actions : one to open a Shape Data dialog and one to call some custom code. You can set up both of them now and then transition into the section about VBA programming to make the second item actually work.

Adding Actions Using the ShapeSheet
1.
Open the ShapeSheet for the notes shape.

2.
Insert an Actions section and make sure it has two rows in it. This is similar to the procedure for adding user-defined cells. Action rows are used to add custom right-click menu items to a shape’s context menu.

3.
Name the first action row Properties and the second one CreateNewNote.

4.
Set the Action and Menu cells for the rows as follows:

Actions.Properties.Action = DOCMD(1312)
Actions.Properties.Menu = "Properties..."
Actions.CreateNewNote.Action =
CALLTHIS("ThisDocument.CreateNewNote")
Actions. CreateNewNote.Menu = "Create New Note"

The Menu cells expect strings. If you have trouble, make sure there are double quotation marks on both sides of the text. Whatever you type in the Menu cell will show in the right-click menu.

The Action cell does the actual work. Actions can be performed in a number of ways such as setting ShapeSheet formulas, calling Visio functions, or invoking macros or add-on code. The first action uses the DOCMD ShapeSheet formula to call command 1312. This is the command id for showing the Shape Data pop-up window. The second Action uses the CALLTHIS function to access a VBA macro that you will write later on.

Figure 10 shows how the Actions section for the notes shape should look.

Figure 10. Actions defined in the ShapeSheet appear when right-clicking the shape.

5.
Close the ShapeSheet and then right-click the modified shape and choose Properties. A pop-up version of the Shape Data window should appear. Here, you can edit the Number field.

6.
If you choose Create New Note from the right-click menu, nothing happens. This action calls macro code that you create in the next section.

That wraps up the ShapeSheet portion of this project, and you’ve achieved quite a lot! You’ve created a smart-sizing arrow. You grouped the arrow with the number box and created resizing smarts that keep the box square, and the arrow using the remaining space. You linked the box’s text to a Shape Data field in the group, and you configured the notes text so that it is nicely aligned within the arrow. To top it all off, you added custom right-click actions that show Shape Data and call VBA macros. Phew! Now it’s time to write that macro, and then discuss ways to deploy your SmartShape in a stencil with a template.

 
Others
 
- Microsoft PowerPoint 2010 : Prepare for Delivery - Saving Presentations as Videos
- Microsoft Visio 2010 : Laying Out Shapes (part 1) - Using Visio’s Layout Features
- Microsoft Access 2010 : TESTING AND DEBUGGING VBA CODE (part 2) - The Debug.Assert Statement, Breakpoints, Stepping through Code
- Microsoft Access 2010 : Using Queries to Retrieve the Data You Need - Opening a Query
- Microsoft Excel 2010 : Calculating the Standard Deviation and Variance (part 2) - Population Parameters and Sample Statistics
- Microsoft Access 2010 : Relating the Information in Your Database - Establishing Referential Integrity
- Microsoft Excel 2013 : Saving a Workbook (part 2) - Save an Excel 97-2003 Workbook
- Microsoft Access 2010 : Protect Databases - Assigning Passwords to Databases
- Microsoft Word 2010 : Employing Tools for Quality - Using Find and Replace (part 1) - Extending Search Options
- Microsoft Visio 2010 : Saving Visio Files in XML Format, Saving Files in Older Visio Formats
 
 
REVIEW
 
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- Sigma 24mm f/1.4 DG HSM Art

- Canon EF11-24mm f/4L USM

- Creative Sound Blaster Roar 2

- Alienware 17 - Dell's Alienware laptops

- Smartwatch : Wellograph

- Xiaomi Redmi 2
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
 
Top 10
 
- How To Install Windows Server 2012 On VirtualBox
- How To Fix Skype High CPU And Memory Usage In Windows 8
- Add 270 Additional Cleaning Options To CCleaner With CCEnhancer
- FPPT Provides More Than 2000 Free And Attractive PowerPoint Templates
- Setup Free Media Server To Stream Videos To DLNA Compatible TV, Xbox 360 & PS3 (Play Station 3)
- How To Install Android Market & Google Apps On Kindle Fire
- How To Make Ubuntu Look Like Windows 7
- How To Add A New Account in MS Outlook 2013
- Get Android & Mac OS X Style Gadgets For Windows 7 & Windows 8 With XWidget
- How To Activate Microsoft Office 2013
<