PivotChart and PivotTable extension features

Source: Internet
Author: User
Chart Wes Kim
Microsoft Corporation

April 2001

Apply to:
Microsoft®access 2002

Summary: Describes how to use events to extend the functionality of the PivotTable view and PivotChart view in Microsoft Access 2002.

Directory
Brief introduction
Where events are available
Data source Events
Show events
Change Event
Command events
Keyboard and mouse events
Summarize

Brief introduction
With the Microsoft®office Web component, Microsoft Access developers can include pivottable® and pivotchart® views in their applications. In Access 2002, several new events have been added to the Access 10.0 object Library, enabling developers to enforce control over the PivotTable and PivotChart views. This article briefly describes these new events and how to use them.

For syntax and code examples of these events, see Access Visual basic® Help.

Where events are available
Not all events are available in the PivotTable and PivotChart views. The following table outlines where the various events are available.

Events can be used in the PivotTable view to be available in the PivotChart view
OnConnect, OnDisconnect whether
BeforeQuery, does Query
AfterLayout, BeforeRender, AfterRender, AfterFinalRender are
DataChange whether
DataSetChange No is
PivotTableChange whether
SelectionChange and ViewChange are
CommandEnabled, commandchecked, CommandBeforeExecute, CommandExecute are
KeyDown, KeyPress, KeyUp, MouseDown, MouseMove, MouseUp, mousewheel*, Click, DblClick are


* in keyboard and mouse events, only the MouseWheel event is a new event for Access 2002.

Data source Events
OnConnect, OnDisconnect
The OnConnect event occurs after the PivotTable view has established a connection to its data source, and the OnDisconnect event occurs after the PivotTable view is disconnected from its data source. It is generally assumed that the connection remains present during the PivotTable session. However, if the connection to the data source is lost, the application can use the OnDisconnect event to warn the user.

BeforeQuery, Query
The BeforeQuery event and query events occur before and after the PivotTable view sends the query to its data source. With these events, the application can notify the user that the query is in progress, that is, to display the message or to change the pointer to an hourglass.

Show events
AfterLayout
The AfterLayout event occurs when the entire layout of the PivotChart view has been computed, but no elements have been drawn on the screen. By capturing this event, an application can draw a shape or generate text on an empty chart canvas before any chart element is drawn, using the ChChartDraw object returned by the drawobject parameter.

BeforeRender, AfterRender
The BeforeRender and AfterRender events occur respectively before and after the elements of each PivotChart view are drawn to the screen. By capturing these events, an application can draw shapes or generate text on a chart before and after drawing a particular element, using the ChChartDraw object returned by the drawobject parameter. In addition, the application can change the location of the element or other properties by using the object returned by the ChartObject parameter before drawing the element.

AfterFinalRender
The AfterFinalRender event occurs after all elements of the PivotTable view are drawn to the screen. By capturing the event, the application can draw the shape or generate text at the top of the chart canvas by using the ChChartDraw object returned by the drawobject parameter after all the chart elements have been drawn.

Change Event
DataChange
The DataChange event occurs when some of the properties of the PivotTable view are changed or some methods are called from the PivotTable view. There are a number of environments that can trigger this event. By calculating the Reason parameters, the application can determine what changes have been made and take appropriate action.

DataSetChange
The DataSetChange event occurs after the dataset in the PivotChart view has changed. This means either that the base data did change because the query was sent to the data source, or that the data displayed in the current PivotChart view has undergone structural changes (for example, a sequence has been added). Because this event does not provide specific information about the cause of the data set change, it is recommended that you use other events, such as the above display event, to capture the specific changes to the PivotChart view.

PivotTableChange
A PivotTableChange event occurs when a field, field set, or grand total is added or deleted from the PivotTable view, and the Reason parameter indicates which of these changes occurred. Capturing this event provides feedback to developers on how users can manipulate the PivotTable view in their applications.

SelectionChange
The SelectionChange event occurs once the current selection has changed in the PivotTable or PivotChart view. The application can then test which objects are currently selected and change the user interface accordingly (for example, customizing a series of available commands based on the current selection).

ViewChange
The ViewChange event occurs once the view has changed in the PivotTable or PivotChart view. For the PivotTable view, the Reason parameter indicates what type of change occurred, and capturing this event causes the application to change the format of the PivotTable view based on how the user changes the current view. For the PivotChart view, the Reason parameter always returns the same value (-1), so capturing this event has limited effect.

Command events
CommandEnabled
The CommandEnabled event occurs when the PivotTable or PivotChart view tests whether the command is available. Command parameters indicate which command is being tested for availability. After the user displays the Command menu, the application can catch the event and dynamically enable or disable the commands using the enabled parameter.

CommandChecked
A commandchecked event occurs when the PivotTable or PivotChart view tests whether a command is selected. The command parameter indicates the state of which commands are being tested. After the user displays the Command menu, the application can try to catch the event and dynamically select or uncheck the commands using the Checked parameter.

CommandBeforeExecute, CommandExecute
The CommandBeforeExecute and CommandExecute events occur before or after a command is executed from the PivotTable or PivotChart view. The command parameter indicates which of the commands will be executed, or which command has just been executed. The Cancel parameter of the CommandBeforeExecute event can be used to cancel the pending command. With these events, the application can prevent the execution of certain commands or warn the user of the status of the pending command.

Keyboard and mouse events
KeyDown, KeyPress, KeyUp, MouseDown, MouseMove, MouseUp, MouseWheel, Click, DblClick
In addition to the MouseWheel event, these keyboard and mouse events are new events for the PivotTable and PivotChart views in Access 2002, but they are generally not new events for access; "Access Visual Basic helps Help "has been introduced in its usage.

The MouseWheel event occurs when the user clicks or scrolls the mouse wheel. An application can catch this event when the developer wants the mouse wheel to trigger the custom action without the default mouse wheel behavior, such as highlighting different columns of the PivotTable view.

Summarize
With these new events in the Access 10.0 Object Library, developers are now able to exert greater control over the PivotTable and PivotChart views in their applications.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.