Type | Description | |||
ID as Long | A long expression that specifies the identifier of the item being opened. |
The OpenPopup event occurs when user opens a popup menu. The ClosePopup event occurs when a popup menu is closed. 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.
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 2 for the OpenPopup event.
Syntax for OpenPopup event, /NET version, on:
private void OpenPopup(object sender,int ID) { } Private Sub OpenPopup(ByVal sender As System.Object,ByVal ID As Integer) Handles OpenPopup End Sub |
private void OpenPopup(object sender, AxEXMENULib._IMenuEvents_OpenPopupEvent e) { } void OnOpenPopup(long ID) { } void __fastcall OpenPopup(TObject *Sender,long ID) { } procedure OpenPopup(ASender: TObject; ID : Integer); begin end; procedure OpenPopup(sender: System.Object; e: AxEXMENULib._IMenuEvents_OpenPopupEvent); begin end; begin event OpenPopup(long ID) end event OpenPopup Private Sub OpenPopup(ByVal sender As System.Object, ByVal e As AxEXMENULib._IMenuEvents_OpenPopupEvent) Handles OpenPopup End Sub Private Sub OpenPopup(ByVal ID As Long) End Sub Private Sub OpenPopup(ByVal ID As Long) End Sub LPARAMETERS ID PROCEDURE OnOpenPopup(oExMenu,ID) RETURN |
<SCRIPT EVENT="OpenPopup(ID)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function OpenPopup(ID) End Function </SCRIPT> Procedure OnComOpenPopup Integer llID Forward Send OnComOpenPopup llID End_Procedure METHOD OCX_OpenPopup(ID) CLASS MainDialog RETURN NIL void onEvent_OpenPopup(int _ID) { } function OpenPopup as v (ID as N) end function function nativeObject_OpenPopup(ID) return |
The following VB sample displays the caption of the item whose submenu is opened:
Private Sub ExMenu1_OpenPopup(ByVal ID As Long) Debug.Print ExMenu1.Item(ID).Caption End Sub
The following C++ sample displays the caption of the item whose submenu is opened:
#include "Item.h" void OnOpenPopupExmenu1(long ID) { OutputDebugString( m_menu.GetItem( COleVariant(ID) ).GetCaption() ); }
The following VB.NET sample displays the caption of the item whose submenu is opened:
Private Sub AxExMenu1_OpenPopup(ByVal sender As Object, ByVal e As AxEXMENULib._IMenuEvents_OpenPopupEvent) Handles AxExMenu1.OpenPopup Debug.WriteLine(AxExMenu1.item(e.iD).Caption) End Sub
The following C# sample displays the caption of the item whose submenu is opened:
private void axExMenu1_OpenPopup(object sender, AxEXMENULib._IMenuEvents_OpenPopupEvent e) { System.Diagnostics.Debug.WriteLine(axExMenu1[e.iD].Caption); }
The following VFP sample displays the caption of the item whose submenu is opened:
*** ActiveX Control Event *** LPARAMETERS id with thisform.ExMenu1 wait window nowait .Item(id).Caption endwith