PullFocus method

Examples


The PullFocus method removes the focus from a window and specifies whether data for the currently-focused field is valid.

Syntax

window.PullFocus

Parameters

window – A window object.

Return value

A boolean indicating whether the method succeeded in pulling the focus from the window:

[spacer]

Value

Description

True

The focus was pulled from the window. Microsoft Dynamics GP field events (user changed and lost focus) verified that the focused field contained valid data.

False

The focus was not pulled from the window. Microsoft Dynamics GP field events determined that the focused field contained invalid data, then displayed a message dialog.


Comments

Use the PullFocus method with windows you’re programmatically controlling through VBA. This includes using VBA to open the window, set window fields, then close the window.

You cannot use the PullFocus method with a window where VBA window events or window field events are occuring. If you do, a VBA error will occur.


The primary use of the PullFocus method is to check whether the currently-focused field contains valid data. The accounting system verifies data in each field when the focus moves out of the field. However, when you’re controlling a window “remotely,” the focus remains in the last field you’ve set using VBA, and the accounting system cannot verify its contents. To manually verify the contents of this field, use the PullFocus method.

The PullFocus method moves the focus off the window, which runs the Microsoft Dynamics GP user changed and lost focus events for the focused field. The accounting system uses these field events to verify the contents of the field. If the field contains invalid data, a message dialog will appear and the PullFocus method will return False. If the focused field contains valid data, the PullFocus method will return True.

We recommend that you use the PullFocus method just prior to programmatically “clicking” the window’s Save button. This allows you to conditionally save the contents of the window if the focused field contains valid data.


Documentation Feedback