Methods on Form Controls

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Each control on a form has a standard group of methods that you can override to customize the behavior of the control. The methods that you can override depend on the type of control. Use the following steps to access these methods.

  1. In the AOT, expand the node for the control.

  2. Right-click the Methods node.

  3. Click Override Method.

The methods available in the Override Method menu are a subset of those available on the system class for that control type. For example, methods for manipulating CheckBox controls are in the FormCheckBoxControl class. The methods for manipulating Grid controls are in the FormGridControl class. For a list of these classes, see Form Control Classes.

Note

Code written on forms cannot be re-used or inherited. If possible, write your code on the underlying table or in a class.

The following table lists methods that you can override. Some of the methods are used by several types of controls although others are unique to a single type of control. For more information about a method, see the related topic in the class reference section of Help. For example, the copy method for a ComboBox control is described in the FormComboBoxControl.copy method topic. The copy method for a Tree control is described in the FormTreeControl.copy method topic.

Method name

Executed when

Comments

activateItem

The user activates an item in a ListView control.

The super call manages the activation of the item (for example, a program) represented by the icon.

activeCellChanged

The user makes a change to the current cell in a Table control.

N/A

allItemsDeleted

The user has deleted all items in a ListView control.

N/A

beginDrag

The user starts to drag a form control or item in a control.

This method is not called if the DragDrop property is disabled for the control.

beginLabelEdit

The user starts editing (renaming) the label for a node in a Tree control.

This method returns a Boolean value. You can use it to prevent a user from editing the label.

clicked

The user clicks a control.

N/A

colLabel

Not activated by the system.

The super call returns the text specified for the column heading in a Table control.

columnClicked

When the user clicks a column header in a ListView control.

Pass in the column index (zero-based) to determine which column the control will be sorted on.

command

The method is deprecated and should not be used. The method might be removed in a future version of Microsoft Dynamics AX.

N/A

context

The user right-clicks the control.

The super call displays the shortcut menu.

copy

The user copies content from a control.

N/A

cut

The user cuts content from a control.

N/A

data

Not activated by the system.

The super) call returns the contents of a cell in a table control.

Note

Do not override the data method. An override might prevent users from accessing their data.

dateTextChange

The method is deprecated and should not be used. The method might be removed in a future version of Microsoft Dynamics AX.

N/A

dialogClosed

The user has closed a dialog box.

Add code that finishes the actions performed in a drop dialog control.

dialogInitialized

The user has opened a dialog box.

Add code that initializes the contents of the drop dialog control.

doubleClick

The user has double-clicked an item in a ListView or ListBox control.

N/A

dragLeave

The user is dragging a control or item in a control from the current control.

N/A

dragOver

The user is dragging a control or an item in a control over another item.

This method is called only if the DragDrop property is enabled for the control and a beginDrag event has already been started.

dragOverEx

The user is dragging a control or an item in a control over the current control.

N/A

dragText

The user is dragging an item in a Tree control.

N/A

drop

The user drops a control or an item in a control into a new position.

This method is called only if the DragDrop property is enabled for the control and a beginDrag event has already been started.

dropEx

The user drops a control or an item in a control onto the current control.

N/A

dropFile

The user drags a file from outside Microsoft Dynamics AX and drops it onto a Window control.

The dropFile method is called by using the file name as the parameter.

editControl

The user moves their mouse pointer over a Tree control.

N/A

endDrag

The user stops dragging a form control or an item in a control.

This method is called only if the DragDrop property is enabled for the control, and a beginDrag event has already been started.

endLabelEdit

The user has finished editing (renaming) the label for a node.

N/A

enter

The user moves focus to a control.

This method is useful for controls where a user can select a particular item, such as a grid cell.

For more information, see the gotFocus method in this topic.

expanded

A Tree control has been expanded.

N/A

expanding

A Tree control is expanding.

This method returns a Boolean value. You can use the value to prevent a user from expanding the tree.

filter

The user clicks the Filter by Selection command in the shortcut menu on a form control.

N/A

gotFocus

The user brings the control into focus.

N/A

hasControlPositionOverride

Used only with the User Personalization form.

Returns a value if the tabchange or tabchanged overrides are present.

helpField

The user clicks the control.

The super call displays the text in the HelpText property for the control. If not specified on the control, this text is inherited from the field or from the extended data type.

You can display another Help text by overriding the method.

hotTrackItem

The user moves the mouse pointer over a list control.

Pass in an integer that specifies the index value from the form list control.

inputSearch

The user enters input in a control that has the SearchMode property set.

You can set up a control to search for the value a user types into the control by setting the SearchMode property. When search starts, the inputSearch method is called by using the search string as a parameter.

isResolvingReference

The user opens a form that contains a ReferenceGroup control and the ReplacementFieldGroup maps to a subset of a key on the primary key table.

You can use this method within lookupReference to know whether the lookup is being presented to help with reference disambiguation.

itemChanged

An item in a ListView control is changed.

N/A

itemChanging

An item in a ListView control is changing.

N/A

itemCopy

The user has copied an item in a ListView or Tree control.

N/A

itemDeleted

The user has deleted an item in a ListView or Tree control.

N/A

itemInserted

The user has inserted an item in a ListView control.

N/A

itemMoved

The user has moved an item in a ListView or Tree control.

N/A

jumpRef

The user starts the View details command on the shortcut menu for the control or by pressing CTRL+ALT+F4.

The super call opens the main table that contains data for the field.

keyDown

The user presses the DOWN ARROW key in a ListView or Tree control.

N/A

labelMouseDblClick

The user double-clicks on the label for the control.

N/A

labelMousedown

The user clicks the mouse pointer when it is over the label for the control.

N/A

labelMouseup

The user releases the mouse pointer over the label for the control.

N/A

leave

The user moves focus out of a control.

This method is useful for controls where a user can select a particular item, such as a grid cell.

For more information, see the lostFocus method in this topic.

loadAutoCompleteData

The user moves focus to a segment in a segmented entry control.

Gets the most recently used (MRU) information to present to the user. MRU information should be related to the current segment in context with the existing segments. Microsoft Dynamics AX includes a set of DimensionController classes you can use to get this information. Override this method and call the loadAutoCompleteData method of the appropriate dimension controller class. For more information, see How to: Add a Segmented Entry Control to a Form.

loadSegments

The user uses a segmented entry control to view, update, or enter a segmented account number.

Clears all dimension segments and asks for them to be reloaded. This occurs upon initial focus, or when the dimension segments have dynamically changed because of business rules. Microsoft Dynamics AX includes a set of DimensionController classes you can use to manage dimensions. Override this method and call the loadSegments method of the appropriate dimension controller class. For more information, see How to: Add a Segmented Entry Control to a Form.

lookupReference

The user clicks on the lookup button, or presses the DOWN ARROW key.

Opens the lookup form you use to pick a new value to include in the ReferenceGroup control.

This differs from the lookup method because it returns the record selected in the lookup.

Typically, you override this method when you want to use a custom lookup form that includes custom filtering, sorting, and form layout.

lookup

The user uses the Lookup facility.

For more information, see How to: Add a Control with a Lookup Form.

lostFocus

The user brings the control out of focus.

N/A

menuFunction

Not called by the system.

This method returns the menu item that is called by the control.

modified

The user exits an edit field (for example, a StringEdit or IntEdit control) after changing it.

–or–

The user changes a value in a CheckBox, ComboBox, ListBox, or RadioButton control.

The super call manages the table update (by a sequence of calls to validate on the data source, validateField on the table, and modified on the data source).

If you change the visibility of the control, add element.redraw() to this method. You use redraw to also update the appearance of the form.

mouseDblClick

The user double-clicks a control.

N/A

mouseDown

The user releases the left mouse pointer button after clicking a control.

N/A

mouseEnter

The user moves the mouse pointer into the control area.

N/A

mouseLeave

The user moves the mouse pointer out of the control area.

N/A

mouseMove

The user moves the mouse pointer over the control.

N/A

mouseUp

The user presses the left mouse pointer button.

N/A

onHScroll

The user horizontally scrolls the image or content that appears in a window control

You use a window control to display images. If the size of the window control is smaller than the image, the control adds scrollbars that you can use to view the image. This method is called when you use the scrollbar.

onVScroll

The user vertically scrolls the image or content that appears in a window control

You use a window control to display images. If the size of the window control is smaller than the image, the control adds scrollbars that you can use to view the image. This method is called when you use the scrollbar.

paint

A Window control is redrawn.

The super call draws the background and displays the .bmp file.

paste

The user pastes content into a control.

N/A

performFormLookup

The user clicks a Lookup button on a control.

N/A

processBase

The method is deprecated and should not be used. The method might be removed in a future version of Microsoft Dynamics AX.

N/A

processForm

The method is deprecated and should not be used. The method might be removed in a future version of Microsoft Dynamics AX.

N/A

processLink

The method is deprecated and should not be used. The method might be removed in a future version of Microsoft Dynamics AX.

N/A

processPicture

The method is deprecated and should not be used. The method might be removed in a future version of Microsoft Dynamics AX.

N/A

processTitle

The method is deprecated and should not be used. The method might be removed in a future version of Microsoft Dynamics AX.

N/A

resolveReference

The user moves focus from the ReferenceGroup control after typing a value into the control.

You use this method to translate the new value into a related record.

Typically, you override this method when you have special filtering requirements or the ReferenceGroup control is displaying a subset of a key and there is some external context which provides the missing part of the key.

rowLabel

Not activated by the system.

The super call returns the text specified as the row heading in a Table control.

segmentEntered

The user moves focus to an individual segment in a segmented entry control.

N/A

segmentValueChanged

The user changes the value in a segment.

Runs when focus leaves a segment and the segment value changed. For more information, see How to: Add a Segmented Entry Control to a Form.

selectionChanged

The user has moved the selection to another item in a ListView or Tree control.

N/A

selectionChange

The user alters the selection in a ComboBox, ListBox, or RadioButton control.

N/A

selectionChanging

The user is moving the selection to another item in a ListView or Tree control.

This method returns a Boolean value. You can use the value to prevent a user from being able to change the selection. For example, to disable the selection of a particular item.

setScrollInfo

Not activated by the system.

This method turns on horizontal and vertical scrollbars for the windows control and sizes them correctly. You can also use this method to turn off horizontal and vertical scrollbars.

showContextMenu

The shortcut menu for a control is opened.

N/A

size

The window control is sized.

The window control is sized when it is first drawn, the form is resized, or the window control is programmatically resized.

sort

The user changes the sort order of a control.

Use the SortOrder enumeration to specify the sort direction.

tabChange

A change of tabbed pages has occurred.

Do not override the tabChange or tabChanged methods on Tab controls. Instead, override the pageActivated and allowPageDeactivate methods on Tabpage controls.

If you override tabChange or tabChanged, the user setup level for the tab cannot be higher than Restricted. The user cannot fully customize the layout and content.

The parameters received for tabChange and tabChanged are based on tabbed page indexes. They depend on the current position of the tabbed page. Prevent users from moving a tabbed page if either of these methods are overridden. The pageActivated and allowPageDeactivate methods do not pass any information about the current position of the tabbed page and enable full user setup.

tabChanged

Immediately before the change of the tabbed page.

If the method returns false, the system does not change the tabbed page.

Do not override this method.

For more information, see the tabChange method in this topic.

textChange

The user types in a field.

N/A

toolTip

The user points to the control with the mouse pointer.

N/A

validate

The user exits a control after entering data.

The super call starts the validateField method on the database table.

See also

Methods on a Form

Methods on a Form Data Source

Overview of Form Control Types

Form Control Properties

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.