event ClosePopup (ID as Long)
Fired when a sub menu is about to be closed.

TypeDescription
ID as Long A long expression that specifies the identifier of the item being closed.

The ClosePopup event occurs when a popup menu is closed. The OpenPopup event is fired when user opens a popup menu. Use the Select event to notify your application that an item is selected. Use the Popup property to specify whether an item contains a sub menu. Use the SubMenu property to retrieve the sub menu. Use the Item property to access an item giving its identifier.

Syntax for ClosePopup event, /NET version, on:

private void ClosePopup(object sender,int ID)
{
}

Private Sub ClosePopup(ByVal sender As System.Object,ByVal ID As Integer) Handles ClosePopup
End Sub

Syntax for ClosePopup event, /COM version, on:

private void ClosePopup(object sender, AxEXMENULib._IMenuEvents_ClosePopupEvent e)
{
}

void OnClosePopup(long ID)
{
}

void __fastcall ClosePopup(TObject *Sender,long ID)
{
}

procedure ClosePopup(ASender: TObject; ID : Integer);
begin
end;

procedure ClosePopup(sender: System.Object; e: AxEXMENULib._IMenuEvents_ClosePopupEvent);
begin
end;

begin event ClosePopup(long ID)
end event ClosePopup

Private Sub ClosePopup(ByVal sender As System.Object, ByVal e As AxEXMENULib._IMenuEvents_ClosePopupEvent) Handles ClosePopup
End Sub

Private Sub ClosePopup(ByVal ID As Long)
End Sub

Private Sub ClosePopup(ByVal ID As Long)
End Sub

LPARAMETERS ID

PROCEDURE OnClosePopup(oExMenu,ID)
RETURN

Syntax for ClosePopup event, /COM version (others), on:

<SCRIPT EVENT="ClosePopup(ID)" LANGUAGE="JScript">
</SCRIPT>

<SCRIPT LANGUAGE="VBScript">
Function ClosePopup(ID)
End Function
</SCRIPT>

Procedure OnComClosePopup Integer llID
	Forward Send OnComClosePopup llID
End_Procedure

METHOD OCX_ClosePopup(ID) CLASS MainDialog
RETURN NIL

void onEvent_ClosePopup(int _ID)
{
}

function ClosePopup as v (ID as N)
end function

function nativeObject_ClosePopup(ID)
return

In VFP9, if using the _SCREEN.AddObject on modal forms, the OpenPopup may not be fired, instead you can use the BINDEVENT to collect the WM_COMMAND message. The lParam of the WM_COMMAND message is 3 for the ClosePopup event.

The following VB sample displays the caption of the item whose sub menu is closed:

Private Sub ExMenu1_ClosePopup(ByVal ID As Long)
    Debug.Print ExMenu1.Item(ID).Caption
End Sub

The following C++ sample displays the caption of the item whose sub menu is close:

#include "Item.h"
void OnClosePopupExmenu1(long ID) 
{
	OutputDebugString( m_menu.GetItem( COleVariant(ID) ).GetCaption() );
}

The following VB.NET sample displays the caption of the item whose sub menu is close:

Private Sub AxExMenu1_ClosePopup(ByVal sender As Object, ByVal e As AxEXMENULib._IMenuEvents_ClosePopupEvent) Handles AxExMenu1.ClosePopup
    Debug.WriteLine(AxExMenu1.item(e.iD).Caption)
End Sub

The following C# sample displays the caption of the item whose sub menu is close:

private void axExMenu1_ClosePopup(object sender, AxEXMENULib._IMenuEvents_ClosePopupEvent e)
{
	System.Diagnostics.Debug.WriteLine(axExMenu1[e.iD].Caption);
}

The following VFP sample displays the caption of the item whose sub menu is close:

*** ActiveX Control Event ***
LPARAMETERS id

with thisform.ExMenu1
	wait window nowait .Item(id).Caption
endwith