Compartir a través de


Scrolling window events

Scrolling windows provide the following events:

LineFillBeforeOriginal

This event occurs before the line fill event for the scrolling window. The line fill event occurs each time a new line is added to the scrolling window from the linked table, such as when the user scrolls to a new line. When the scrolling window first fills, the line fill event occurs repeatedly until the scrolling window is full. The line fill event also occurs each time the user moves the focus to an existing line in the scrolling window. The line fill event occurs before the line enter event.

To find out what data will be added to the current row of the scrolling window, examine the current row of the form-level table buffer for the table linked to the scrolling window.

Hint: When using this event, you cannot examine the window fields for the scrolling window to determine what row is being added. The values of the window fields will not have been set yet.

The LineFillBeforeOriginal event can be cancelled. If the event is cancelled, the current row in the table linked to the scrolling window will not be added to the scrolling window.

For example, the following C# code registers the LineFillBeforeOriginal event for the scrolling window in the Customers and Prospects window in Microsoft Dynamics GP.

public void Initialize()
{
    Dynamics.Forms.CustomerLookup.CustomerLookup.CustomerLookupScroll.
    LineFillBeforeOriginal += new System.ComponentModel.CancelEventHandler
    (CustomerLookupScroll_LineFillBeforeOriginal);
}

The following is the C# code that runs in response to this event. It allows only customers in the "TERRITORY 2" sales territory to be displayed. The RmCustomerMstr table is linked to the scrolling window, so the values for the scrolling window come from this table. Notice how the code is accessing the current row of the form-level table buffer for the RmCustomerMstr table to find out what row is being added to scrolling window. The SalesTerritory field in the current row of the table is examined. If it is not "TERRITORY 2", the event is cancelled. This prevents the row from being displayed in the scrolling window.

void CustomerLookupScroll_LineFillBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)
{
    if(Dynamics.Forms.CustomerLookup.Tables.RmCustomerMstr.SalesTerritory.Value != "TERRITORY 2")
    {
        // Not in TERRITORY 2, so do not display the line
        e.Cancel = true;
    }
}

LineFillAfterOriginal

This event occurs after the line fill event for the scrolling window.

LineEnterBeforeOriginal

This event occurs when the focus moves to a line in the scrolling window, but before the scrolling window's line enter event is run. This event can be canceled.

LineEnterAfterOriginal

This event occurs when the focus moves to a line in the scrolling window, but after the scrolling window's line enter event is run.

LineChangeBeforeOriginal

This event occurs when the focus leaves a line in the scrolling window, and the contents of the line has been modified. The event runs before the scrolling window's line change event is run. This event can be canceled.

LineChangeAfterOriginal

This event occurs when the focus leaves a line in the scrolling window, and the contents of the line has been modified. The event runs after the scrolling window's line change event is run.

LineLeaveBeforeOriginal

This event occurs when the focus leaves a line in the scrolling window, but before the scrolling window's line leave event is run. This event can be canceled.

LineLeaveAfterOriginal

This event occurs when the focus leaves a line in the scrolling window, but after the scrolling window's line leave event is run.

LineInsertBeforeOriginal

This event occurs when a new line is added to the scrolling window, but before the scrolling window's line insert event is run. This event can be canceled.

LineInsertAfterOriginal

This event occurs when a new line is added to the scrolling window, but after the scrolling window's line insert event is run.

LineDeleteBeforeOriginal

This event occurs when a line is removed from the scrolling window, but before the scrolling window's line delete event is run. This event can be canceled.

LineDeleteAfterOriginal

This event occurs when a line is removed from the scrolling window, but after the scrolling window's line delete event is run.