InPlaceMenu Event

Object List Next Object

Defined By:
Form

Description:

Raised when an Ole Server is activated "in-place" to merge the menus of the object (server) and container.

Usage:

Sub InPlaceMenu(WhichMenuGroup As Integer, MenuHandle As Long, SubMenuIndex As Long, NumberOfSubMenus As Long)


Arguments Description


WhichMenuGroup (Global)

OleConstants.FILE_MENUGROUP = 0

OleConstants.CONTAINER_MENUGROUP = 2

OleConstants.MDIWINDOW_MENUGROUP = 4

MenuHandle Should be set to HMenu of container's menubar object

SubMenuIndex Set to index in menubar of requested group's first submenu

NumberOfSubMenus Set to the number of submenus in the requested group

Details:

An application's menu bar can be logically divided into the following groups:

images/Phx90000.gif file - open/save operations

images/Phx90000.gif edit - cut, paste, modify

images/Phx90000.gif container/object - operations specific to the application

images/Phx90000.gif MDI Window - manage Multiple document windows

images/Phx90000.gif help - access to help

When an OLE object server application in-place activates in a container application, the user's interface reflects the activation by merging the menus of both. Merged menus are divided into these groups:

0 containers file

  1. objects edit

  2. container specific menus

  3. object specific menus

  4. containers MDI Window

  5. objects help

When an OLE server becomes in-place active, the containing form will receive three InPlaceMenu events; one for each group of the merged menu it must supply.

The WhichMenuGroup argument specifies which group is needed, for example, it will be 0, 2, or 4 (file, container, or mdi window). These items can be referred to by using the following constants: OleConstants.FILE_MENUGROUP = 0, OleConstants.CONTAINER_MENUGROUP = 2, and OleConstants.MDIWINDOW_MENUGROUP = 4.

If the form has a menubar, then it should supply code for the event which:

images/Phx90000.gif sets the MenuHandle to HMenu of the form's menubar object

images/Phx90000.gif sets the SubMenuIndex to the index in the menubar of the requested group's first submenu

images/Phx90000.gif sets the NumberOfSubMenus to the number of submenus present in the requested group

Example:

Sub InPlaceMenu(WhichMenuGroup as integer, MenuHandle, SubMenuIndex, NumberOfSubMenus as long)

If WhichMenuGroup == 0 Then

MenuHandle = MenuBar.HMenu

SubMenuIndex = 0

NumberOfSubMenus = 1

End If

If WhichMenuGroup == 2 Then

MenuHandle = MenuBar.HMenu

SubMenuIndex = 2

NumberOfSubMenus = 1

End If

End Sub

See Also:

Load event, Unload event, UnloadForm method