MENU command is not implemented. How can I get a right click popup menu?
EMG
EMG try this:
- Code: Select all Expand view RUN
// FiveWin for Pocket PC - Using popup menus
#include "FWCE.ch"
#define MF_ENABLED 0
#define TPM_VERTICAL 0x0040
#define TPM_RETURNCMD 0x0100
#define MFT_SEPARATOR 0x0800
#define MF_CHECKED 0x0008
#define MF_UNCHECKED 0x0000
#define MF_POPUP 0x0010
//-----------------------------------------------------------------------------------------------------//
FUNCTION Main()
LOCAL oWnd
DEFINE WINDOW oWnd TITLE "Popup menu"
oWnd:bLClicked:={ | nRow, nCol | PopupMenu( oWnd, nRow+28, nCol ) }
ACTIVATE WINDOW oWnd
RETURN ( nil )
//-----------------------------------------------------------------------------------------------------//
STATIC FUNCTION PopupMenu( oWnd, nRow, nCol )
LOCAL nIdSelect
LOCAL hMenu := CreatePopupMenu()
LOCAL hSubMenu := CreatePopupMenu()
AppendMenu( hMenu, MF_ENABLED, 10, "One" )
AppendMenu( hSubMenu, MF_ENABLED, 11, "Submenu 1")
AppendMenu( hSubMenu, MF_ENABLED, 12, "Submenu 2")
AppendMenu( hSubMenu, MFT_SEPARATOR)
AppendMenu( hSubMenu, MF_ENABLED, 13, "Submenu 3")
AppendMenu( hMenu, MF_POPUP, hSubMenu, "Two" )
AppendMenu( hMenu, MFT_SEPARATOR)
AppendMenu( hMenu, MF_ENABLED, 14, "Three")
CheckMenuItem( hMenu, 14, MF_CHECKED )
CheckMenuItem( hSubMenu, 13, MF_CHECKED )
nIdSelect := TrackPopupMenuEx( hMenu, TPM_RETURNCMD, nRow, nCol, oWnd:hWnd )
IF nIdSelect == 10
MsgInfo ( "One" )
ELSEIF nIdSelect == 11
MsgInfo ( "Submenu 1" )
ELSEIF nIdSelect == 12
MsgInfo ( "Submenu 2" )
ELSEIF nIdSelect == 13
MsgInfo ( "Submenu 3" )
ELSEIF nIdSelect == 14
MsgInfo ( "Three" )
ENDIF
DestroyMenu(hMenu)
RETURN nil
//-----------------------------------------------------------------------------------------------------//
#pragma BEGINDUMP
#include <windows.h>
#include <hbapi.h>
LPWSTR AnsiToWide( LPSTR );
#define IF(x,y,z) ((x)?(y):(z))
HB_FUNC( CREATEPOPUPMENU )
{
hb_retnl( ( LONG ) CreatePopupMenu() );
}
HB_FUNC( APPENDMENU )
{
LPWSTR pW = AnsiToWide( hb_parc( 4 ) );
hb_retl( AppendMenu( ( HMENU ) hb_parnl( 1 ), ( UINT ) hb_parnl( 2 ), hb_parnl( 3 ),
IF( ISCHAR( 4 ), pW, ( LPWSTR ) hb_parnl( 4 ) ) ) );
hb_xfree( pW );
}
HB_FUNC( TRACKPOPUPMENUEX )
{
hb_retnl( ( LONG ) TrackPopupMenuEx( ( HMENU ) hb_parnl( 1 ), hb_parni( 2 ), hb_parni( 4 ),
hb_parni( 3 ), ( HWND ) hb_parni( 5 ), NULL ) );
}
HB_FUNC( DESTROYMENU )
{
hb_retl( DestroyMenu( ( HMENU ) hb_parnl( 1 ) ) );
}
HB_FUNC( CHECKMENUITEM )
{
hb_retnl( ( LONG ) CheckMenuItem( ( HMENU ) hb_parnl( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) );
}
#pragma ENDDUMP
Regards,
Pier luigi
Return to FiveWin for Pocket PC
Users browsing this forum: No registered users and 5 guests