This document describes technologies that are available in Internet Explorer 5. An earlier version of the DHTML Editing Component that is compatible with Internet Explorer 4.01 is available as an SDK that you can download from here.
Microsoft Corporation
Updated June 11, 1999
The following events are exposed by the DHTML Editing control.
The host application can also get DHTML events fired inside the control, such as onclick and onmousemove. For details, see "Handling DHTML Events Inside the Document" in the topic Responding to DHTML Editing Control Events.
See Also
ActiveX Control Properties, ActiveX Control Methods, ActiveX Control Command IDs
Description
Fired when the user has selected one of the items on the context menu to notify the host to perform the specified action.
Syntax
ContextMenuAction ( itemIndex )
Part | Description |
itemIndex | A numeric (long) value representing an index into the menuStrings array that was passed in the SetContextMenu method. |
Remarks
Use this event to be notified when a user has selected an item from the context menu. The itemIndex parameter tells you what menu item was selected so you can take appropriate action.
A context menu is created using the SetContextMenu method. When the user right-clicks to display the context menu, the ShowContextMenu event is fired before the menu is displayed.
Note If you are using JavaScript to bind to this event, you must include a parameter in the function declaration in the EVENT attribute. For example, a <SCRIPT> element bound to this event might look like this:
<SCRIPT FOR="DHTMLEdit1" EVENT="ContextMenuAction(iIndex)">
If you are working with generated code--such as that generated in Microsoft® Visual InterDev by the Script Outline--you must manually add the parameter information.
To see an example of how to use this event, see the VBEdit sample application. For more details about sample applications, see "Sample Applications" under "Overview of the DHTML Editing Component."
See Also
Responding to DHTML Editing Control Events
Description
Fired in response to any change in the state of the document to alert that the user interface should be updated.
Syntax
DisplayChanged ( )
Remarks
This event is fired when any action occurs in the document, including:
- Initializing a new document or loading an existing one.
- Movement of the insertion point.
- Selection.
Note The DisplayChanged event is fired very frequently (with each user gesture), so if you write a handler for this event, the handler should be as efficient as possible, or it will adversely affect performance in the control.
You can use this event to update any elements outside the control that reflect the current state of the document. For example, if you are displaying the document's raw HTML in addition to the document as viewed in the control, you can add a handler for this event to update the raw HTML to reflect edits made in the control.
See Also
Responding to DHTML Editing Control Events, Creating Toolbars and Menus for the DHTML Editing Control
Description
Fired to indicate that the control has finished loading or initializing the current document.
Syntax
DocumentComplete ( )
Remarks
This event indicates that the control is now ready to accept editing commands. The event indicates that the document has been completely parsed and its object model created. Until this event has been fired, you should not attempt to get or set the contents of the document, or an error will result.
A typical use of this event is to enable user interface elements such as menus, toolbars, and so on.
The DocumentComplete event is fired when the control is first instantiated. Thereafter, the event is fired when the control has finished running or setting any of the following:
- LoadDocument method
- LoadURL method
- NewDocument method
- BaseURL property
- BrowseMode property
- DocumentHTML property
Certain properties, such as DocumentHTML and DOM, are not valid until this event has been fired. If you attempt to access these properties before the event has fired, a DE_E_UNEXPECTED error occurs.A complementary property, Busy, returns True while a document is being initialized, parsed, or loaded. After the DocumentComplete event has fired, the Busy property returns False.
Note If you are hosting a DHTML Editing control on a Web page, and if the control is hidden, the control's default document is not initialized until the control is made visible (or until a document is explicitly loaded into the control with the LoadDocument or LoadURL method). As a result, the DocumentComplete event is not fired when the Web page is loaded into the browser. You can force the control to initialize its default page by calling the Refresh method in a window_onload handler.
See Also
Responding to DHTML Editing Control Events, Loading and Saving Documents, Working with HTML Source Code
Description
Fired when the user right-clicks the editing control, but before the context menu is displayed.
Syntax
ShowContextMenu ( xPos, yPos )
Part | Description |
xPos | An integer value giving the x-coordinate of the mouse (right) click |
yPos | An integer value giving the y-coordinate of the mouse (right) click |
Remarks
Use this event to create or change a context menu dynamically before it is displayed. To create or change the context menu, call the SetContextMenu method. To determine what item a user has selected from the context menu, create a handler for the ContextMenuAction event.
Alternatively, hosts can also display their own context menu.
Note If you are using JavaScript to bind to this event, you must include parameters in the function declaration in the EVENT attribute. For example, a <SCRIPT> element bound to this event might look like this:
<SCRIPT FOR="DHTMLEdit1" EVENT="ShowContextMenu(xPos, yPos)">
If you are working with generated code-- such as that generated in Visual InterDev by the Script Outline--you must manually add the parameter information.
See Also
Responding to DHTML Editing Control Events