Volume 3: Programming with the Visio Object Model disclaimer



Download 0.78 Mb.
Page23/36
Date29.01.2017
Size0.78 Mb.
#11974
1   ...   19   20   21   22   23   24   25   26   ...   36

Lesson 2: Related Topics


Data Graphics heavily utilizes Visio’s Shape Data features. The custom solution developer must recognize that there while be Shape Data fields created by the end user and also Shape Data fields created for use by Data Graphics.
Lesson Objectives

After completing this lesson you will be able to:

  • Distinguish between Shape Data used to define Data Graphic fields and Shape Data used to store general information within a shape.

  • Understand the relationship of Shape Data and Data Graphics and use Shape Data to define the property fields of text callouts and data bar callouts

18.Shape Data Management


With the advent of data graphics and data linking in Visio 2007 the Shape Data section of the ShapeSheet takes on additional responsibilities. Previously, it was used mostly as place to store extra data to be associated with a shape. This data could be viewed through the Shape Data window and reports could be generated from it using the Reports tool. If the data was to be viewed visually, the shape needed to be programmed to do something with the data. As an example, consider the timeline shapes that hold information about the timeline in shape data. This data is used to control the graphical output of the shape.

Beginning with Visio 2007, in addition to serving as the repository of data associated with shapes, Shape Data is also used to define fields in data graphic callouts. These fields control the display of the prompts in the Edit Item dialog.

The data linking features of Visio automatically add shape data fields for each field in a record being linked to a shape if that shape data field does not already exist in the shape.

How to add shape data

The basic techniques of adding shape data have not changed, although the menus changed with Visio 2007 from Custom Properties to Shape Data.
Define Shape Data dialog

The Shape Data dialog still exists with the revised interface of Visio 2010. There are a couple of options for viewing the dialog.

  • Right-click in the Shape Data window and choose Define Shape Data

  • Right-click a shape (or selection) and choose Data > Shape Data
The ShapeSheet

Shape Data fields can be created in the ShapeSheet window by adding rows to the Shape Data section and filling in the values for each of the cells in the row.
Shape Data sets

Shape Data Sets allow the copying of a group of shape data fields in mass from one shape to another. This feature is available as a right-click menu of the Shape Data window.
Effect of LockCustProp cell in Protection section

There is a Protection section cell named LockCustProp that affects the user’s ability to add shape data through the user interface. This cell is available only through the ShapeSheet. It is not displayed in the user interface in the Protection dialog.

This cell determines whether the user can add, delete, or modify shape data in the user interface using the Define Shape Data dialog box or the shortcut menu for the Shape Data window.

When the cell has a value of True the Define button does not appear in the Shape Data dialog box, and the Define Shape Data command on the shortcut menu in the Shape Data window is disabled.

A value of TRUE does not prevent a user from changing the value of a shape data item or changing the Shape Data section in the ShapeSheet window.


Relationship of shape data and data graphics

Visio places the data to be displayed in a Shape Data row named Prop.msvCalloutField. Design the callout to make use of the information in this row in whatever way is desired. Note that Visio uses Shape Data rows in callouts in highly specialized ways and that these rows are not intended to be used as standard Shape Data properties. For this reason, you should set the Invisible cell value in these Shape Data rows to TRUE to hide these rows from the user.

text and data-bar callout shape data cells

Figure . Text and Data Bar callout Shape Data cells

Visio puts the following information into cells in the Prop.msvCalloutField row when the callout is used in a data graphic.



Table . Prop.msvCalloutField cells written by Visio

Cell

Value

Label

Not set by Data Graphics.

Prompt

Not set by Data Graphics.

Type

Not set by Data Graphics.

Format

If data field is a Shape Data property, Format of Shape Data property.

If data field is not a Shape Data property, not set by Data Graphics.



Value

Reference to data field value.

SortKey

If data field is a Shape Data property, Label of Shape Data property.

If data field is not a Shape Data property, not set by Data Graphics.



Invisible

Not set by Data Graphics, TRUE recommended.

Ask

Not set by Data Graphics.

LangID

If data field is a Shape Data property, LangID of Shape Data property.

If data field is not a Shape Data property, LangID of target shape.



Calendar

If data field is a Shape Data property, Calendar of Shape Data property.

If data field is not a Shape Data property, not set by Data Graphics.


You specify the data field to be shown in the callout when you include the callout in a data graphic. You can define additional properties for text callouts or data bars to expose in the Edit Item dialog. These properties enable you to configure the callout in special ways.

You define custom callout properties by creating additional Shape Data rows that have names beginning with the prefix Prop.msvCalloutProp.

custom callout property cells

Figure . Custom callout property cells

Visio interprets these cells in the property rows in the following ways.



Table . Custom callout property cells read by Visio

Cell

Value

Label

Property label to be displayed in dialog boxes.

Prompt

Control type of property (defined below).

Type

Not used.

Format

For List control types, semicolon-delimited list of choices.

For Field control types, format of data field or empty if field is not a Shape Data property.

For String control types, optional default value for the property.


Invisible

Not used by Data Graphics, TRUE recommended.

Ask

Not used.

Visio puts the following information back into these cells in the property rows.



Table . Custom callout property cells written by Visio

Cell

Value

Value

Property value.

SortKey

For Field control types where data field is a Shape Data property, Label of Shape Data property.

LangID

For Field control types where data field is a Shape Data property, LangID of Shape Data property.

For Field control types where data field is not a Shape Data property, LangID of target shape.

For Format control types, LangID of data format picture.


Calendar

For Field control types where data field is a Shape Data property, Calendar of data field.

For Format control types, Calendar of data format picture.


Visio supports a variety of input controls in the Edit Item dialog. The Prompt cell specifies the control to be displayed. Other cells might be interpreted in different ways, depending on the control type.



Table . Custom callout property control types

Control Type

Prompt cell value

Control used in dialog box

String

"String"

Text box

Number

"Number"

Text box requiring numeric input

List

"List"

Drop-down list box with choices supplied by the Format cell

Boolean

"Bool"

Drop-down list box with yes and no choices

Date

"Date"

Text box with date picker

Field

"Field"

Data-field drop-down list box

Data Format

"Format"

Text box with Data Format button


custom callout property examples



Figure . Custom callout property examples

Field controls offer the same choice of fields as the data-field drop-down list box, with the addition of a [Not Used] choice. If you select [Not Used], Visio places the formula NA() in the property's Value cell.




Download 0.78 Mb.

Share with your friends:
1   ...   19   20   21   22   23   24   25   26   ...   36




The database is protected by copyright ©ininet.org 2024
send message

    Main page