ArcFM Desktop Overview > ArcFM Overview > Autotext Elements |
This section shows how you can build custom text sources for custom autotext elements. The custom autotext elements functionality allows users to insert text (such as date and page number) to be automatically updated in a page layout. In this section, you will learn how to create your own autotext sources for use with ArcFM’s custom autotext elements. The user will access autotext elements through the Insert menu on the main ArcMap toolbar. |
|
|
The autotext element object is a component that implements IElement (see ArcObjects documentation), and handles configuration, drawing, and persistence. It is aware of a custom autotext source, which provides it with the text to display. The source component is responsible for refreshing its data when appropriate. You can write custom text source objects that programmatically provide event-specific text to an autotext element. IMMAutoTextSourceSymbol is an optional interface that allows you to define the text symbol font, size, color, etc. for an autotext element. If you set these text symbol properties using this interface, the user will be prevented from overriding them in ArcMap. If the IMMAutoTextSourceSymbol interface is not used, the user may set the text symbol properties in ArcMap by right clicking the autotext and selecting Properties. |
Implement IMMAutoTextSource and all its methods.
Determine the events in which to refresh the string. For example, in mmPlotNewPage, most sources would refresh the string.
In the TextString method, write the custom code to update the contents of the string. Have the method return the string as a return value.
Note: The TextString method passes in an IMMMapProductionInfo parameter (named pMapProdInfo). During the mmCreate, mmRefresh, mmDraw, and mmFinishPlot events, the IMMMapProductionInfo parameter is set to nothing. Custom autotext elements should not have any dependencies upon this parameter during these events.
Register the component in the M&M Custom Text Sources (MMCustomTextSources) component category.
Once a custom autotext source is written and registered into its component category, it will become available in the Autotext tool in the ArcMap Insert Menu.