Skip to content

CreatePopupComInstance - cCJContextMenu

Is called to create all of the COM objects needed for the context menus

Type: Procedure

Syntax

Procedure CreatePopupComInstance

Call Example

Send CreatePopupComInstance

Description

CreatePopupComInstance is called to create all COM objects needed for the context menus. It is called by the Popup method.

You should never send this message and you should rarely need to augment it.

The Create PopupComInstance Process

When an context menu is invoked, the message Popup is sent to the context menu. This sends the message CreatePopupComInstance, which is the message that creates the all of the COM popup menu objects. CreatePopupComInstance does the following:

  1. It creates the COM context menu object and binds it to this proxy object.

  2. It applies the cCJContextMenu proxy properties (e.g., pbEnableAnimation) and applies them to the COM objects (e.g.,ComEnableAnimation).

  3. It sends the OnCreate event.

  4. It creates all child cCJMenuItem objects by sending the message CreateComInstance to its children.

  5. It sends the private message PopupInit. This message sends Update to all children. The Update message ensures that all child menu items are properly enabled, checked, and visible.

  6. It sends the OnPopupInit event. This is the event you will use to further customize menus items before the menu is invoked. You may also use this method to add or remove menu items dynamically. If the functions IsChecked, IsEnabled and IsVisible are properly coded in your child objects you will not need to do anything within OnPopupInit to set these child item properties. If you are not using these functions to set these properties you will need to write code to handle this by setting their pbChecked, pbEnabled and pbVisible properties yourself.

When complete, the COM objects are all created. The Popup method will now display the menu. When the menu is closed, the COM objects will all be destroyed.