Show All

# Editing context in the Structural Editing developer sample form

Editing context in a Microsoft Office InfoPath 2003 form is the dependence of editing actions on the current selection or insertion point. For example, if a row in the Structural Editing developer sample form Parts table is selected, the buttons for adding or removing parts on the Part Toolbar custom toolbar are enabled and will insert or remove rows in the Parts table at a position based on the current context. If current selection is not on or within one of the rows in the table, the buttons are disabled.

Note The Part Toolbar custom toolbar was created by modifying the default Form toolbar.

The following are some of the areas in the InfoPath user interface in which editing context is applicable:

- Insert menu Menu items available on the Insert menu. These typically include menu items for inserting items in a table or section.
- Shortcut menu Menu items available on the shortcut menu. These typically include menu items for inserting or removing items in a table, section, or list.
- Table menu Menu items available on the Table menu. These typically include menu items for inserting or removing items in a table.
- Custom toolbar Buttons and menu items available on a custom toolbar. These typically include buttons or menu items for inserting or removing items in a table or section, or buttons that call scripting code.

In the Structural Editing developer sample form, a repeating table control is used to implement a table that allows users to edit a list of parts in an invoice. When a user chooses to edit the table using the Insert menu, the Part Toolbar custom toolbar, or the shortcut menu, InfoPath determines the control being used, and based on the editing actions set in design mode for that control, performs the appropriate editing of the source XML document.

The structural editing controls have predetermined editing actions that can be associated with toolbar buttons and menu items in InfoPath user interface areas. The Commands dialog box that is available from a structural editing control's Properties dialog box allows you to choose which editing actions of the control are available to users, which user interface area they appear in, and the labels that are used for the associated buttons or menu items. In the Parts table of the Structural Editing developer sample form, the following editing actions are enabled:

- Insert Enabled on the Insert menu. Allows a user to insert a new row in the Parts table.
- Insert Above Enabled on the shortcut menu and the Part Toolbar custom toolbar. Allows a user to insert a new row in the Parts table that is above the currently selected row.
- Insert Below Enabled on the shortcut menu and the Part Toolbar custom toolbar. Allows a user to insert a new row in the Parts table that is below the currently selected row.
- Remove Enabled on the shortcut menu and the Part Toolbar custom toolbar. Allows a user to remove the currently selected row.

Note Other editing actions can be used in a repeating table control that are not implemented in the Structural Editing developer sample form.

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp