#Include API_Menu.h Private po_Menu po_Menu = NewObject( 'PopupMenu', 'OwnerDrawn_Menu' ) If (VarType( po_Menu ) != 'O') Return endif Local array la_PopupHandle[1] Local lc_OldTalk, lc_OldNotify, lc_OldNotifyCursor ** Just in case somethings going wrong (for debugging purposes) On key label ALT+F10 Do QuitProg On shutdown Do QuitProg Set SysMenu save && save VFP system menu lc_OldTalk = set( 'Talk' ) lc_OldNotify = set( 'Notify' ) lc_OldNotifyCursor = set( 'Notify', 1 ) Set talk off Set notify off Set notify cursor off If !('TEST' $ set( 'Procedure' )) Set procedure to Test additive endif With po_Menu Dimension .aMenuPad[ 2, 2 ] Dimension la_PopupHandle[ 3 ] .hWndParent = _VFP.hWnd .Gdiplus_Start() .lGlassy = .T. .lUseGradient = .T. .nHiliteStyle = 1 .lEnhancedHilite = .T. .lHiliteUseFontBold = .T. .SetRightColor( 16777215, .F. ) .SetLeftColor( 16308674 ) *** Create Menu Pad .aMenuPad[ 1, 1 ] = '\<File' .aMenuPad[ 1, 2 ] = 'F' && Key = Alt+F .aMenuPad[ 2, 1 ] = '\<Edit' .aMenuPad[ 2, 2 ] = 'E' && Key = Alt+E .CreatePad() *** Create popup (index no. = 1) .CreatePopupItem( 4 ) .aPopupItem[ 1 ] = 'Page Set&up...' .aPopupItem[ 2 ] = 'Print Pre&view' .aPopupItem[ 3 ] = '&Print...' .aPopupItem[ 4 ] = 'E&xit' la_PopupHandle[ 1 ] = .CreatePopup( 100001, 1 ) *** Create popup (index no. = 2) .CreatePopupItem( 5 ) .aPopupItem[ 1 ] = '&Undo' .aPopupItem[ 2 ] = 'Re&do' .aPopupItem[ 3 ] = 'Cu&t' .aPopupItem[ 4 ] = '&Copy' .aPopupItem[ 5 ] = '&Paste' la_PopupHandle[ 2 ] = .CreatePopup( 200001, 2 ) ** Set Submenu to MainMenu .SetSubmenu( 1, 1 ) .SetSubmenu( 2, 2 ) .BindMessages() Release la_PopupHandle Activate menu (.cMenuName) nowait .SetMenuBarColor( 16308674 ) EndWith Read events po_Menu = Null Release po_Menu On key label ALT+F10 On shutdown Release popup all Clear class PopupMenu Clear resources Release procedure Test Set talk &lc_OldTalk Set notify &lc_OldNotify Set notify cursor &lc_OldNotifyCursor Set SysMenu to default Set SysMenu NoSave ****************************************** Procedure QuitProg Clear events EndProc Procedure OnSelection( tn_MenuPos, tn_ItemId ) Do case Case (m.tn_MenuPos == 1) Do Proc__mfile with ; m.tn_MenuPos, m.tn_ItemId - 100000 Case (m.tn_MenuPos == 2) Do Proc__medit with ; m.tn_MenuPos, m.tn_ItemId - 200000 Case (m.tn_MenuPos == 3) Do Proc__MEDIT__med_bkmks with ; m.tn_MenuPos, m.tn_ItemId - 210000 Otherwise Wait 'WM_DOCOMMAND: ' + transform( m.tn_MenuPos ) + ' ' + ; transform( m.tn_ItemId ) window nowait EndCase EndProc Procedure Proc__mfile( tn_MenuPos, tn_ItemPos ) Do case Otherwise Wait 'Proc__mfile: ' + transform( m.tn_MenuPos ) + ' ' + ; transform( m.tn_ItemPos ) window nowait EndCase EndProc Procedure Proc__medit( tn_MenuPos, tn_ItemPos ) Do case Otherwise Wait 'Proc__medit: ' + transform( m.tn_MenuPos ) + ' ' + ; transform( m.tn_ItemPos ) window nowait EndCase EndProcbut i do not know what must i write in this procedures
Procedure OnSelection( tn_MenuPos, tn_ItemId ) Do case Case (m.tn_MenuPos == 1) Do Proc__mfile with ; m.tn_MenuPos, m.tn_ItemId - 100000 Case (m.tn_MenuPos == 2) Do Proc__medit with ; m.tn_MenuPos, m.tn_ItemId - 200000 Case (m.tn_MenuPos == 3) Do Proc__MEDIT__med_bkmks with ; m.tn_MenuPos, m.tn_ItemId - 210000 Otherwise Wait 'WM_DOCOMMAND: ' + transform( m.tn_MenuPos ) + ' ' + ; transform( m.tn_ItemId ) window nowait EndCase EndProc Procedure Proc__mfile( tn_MenuPos, tn_ItemPos ) Do case Otherwise Wait 'Proc__mfile: ' + transform( m.tn_MenuPos ) + ' ' + ; transform( m.tn_ItemPos ) window nowait EndCase EndProc Procedure Proc__medit( tn_MenuPos, tn_ItemPos ) Do case Otherwise Wait 'Proc__medit: ' + transform( m.tn_MenuPos ) + ' ' + ; transform( m.tn_ItemPos ) window nowait EndCase EndProcWarm Regards,