Note: This page includes content based on the F1 documentation for Centura development. It may be partially converted to support APF development, but should be regarded to be of uncertain actuality. It is provided as is. Eventually, it should be replaced by documentation available from within Visual Studio.
Const.PM_ContextMenu
An application or the framework sends Const.PM_ContextMenu message to a window object to invoke a named popup menu.
Name | Description |
---|---|
bUseMousePos = wParam | Specified whether the popup menu should be placed near the mouse position or near the cursor position. |
sMenu = SalNumberToHString( lParam ) | Name of popup menu to invoke. For Foundation1 objects applications can retrieve this name by calling method ContextMenuNameGet. |
Application should return TRUE if the menu was successfully invoked, FALSE otherwise.
The framework automatically sends the PM_ContextMenu message when the user right-clicks with the mouse or presses Ctrl+F11 in an edit control. If no menu is defined for an object, the framework automatically forwards this message to the parent object.
This example sends the Const.PM_ContextMenu message to invoke a popup menu when the user clicks with the right mouse button.
On WM_RBUTTONUP Return SalSendMsg( hWndItem, PM_ContextMenu, METHOD_Execute, SalHStringToNumber( ..ContextMenuNameGet() ) )private void cWindowBase_MessageActions(ref SalMessage message) { #region Actions switch (message.Code) { case Const.WM_RBUTTONUP: this.cWindowBase_OnWM_RBUTTONUP(ref message); break; } #endregion } private void cWindowBase_OnWM_RBUTTONUP(ref SalMessage message) { #region Actions message.Handled = true; if (Sal.SendMsg(this.i_hWndFrame, Const.AM_CreateCustomMenu, Const.METHOD_Inquire, Const.MENU_Standard)) { message.Return = Sal.SendMsg(Sys.hWndItem, Const.PM_ContextMenu, Const.METHOD_Execute, this.vrtContextMenuNameGet().ToHandle()); return; } else { message.Return = Sal.SendMsg(Sys.hWndItem, Const.PM_ContextMenu, Const.METHOD_Execute, (this.vrtContextMenuNameGet() + "User_").ToHandle()); return; } #endregion }