*** The caller for PopupMenu (RightClick event) Local array la_PopItem[6] Local lo_Popup as PopupMenu of OwnerDrawn_Menu Local ln_Result la_PopItem[1] = 'Testing Menu #&1' la_PopItem[2] = 'Testing Menu #&2' la_PopItem[3] = '' la_PopItem[4] = 'Testing Menu #&3' la_PopItem[5] = 'Testing Menu #&4' la_PopItem[6] = 'Testing Menu #&5' lo_Popup = NewObject( 'PopupMenu', 'OwnerDrawn_Menu' ) With lo_Popup .lClearDLL = .F. .hWndParent = _VFP.hWnd .CreatePopup( @la_PopItem, 11 ) && first PopupId = 11 Store .T. to .lUseGradient, .lUseGradientHilite Store !This.IsBound to .lBind, .lUnBind ln_Result = .ActivatePopup() If (ln_Result != 0) ** Popup selected, do the process... endif .oPopTimer = Null EndWith lo_Popup = Null *********************** *** Part of ActivatePopup method - PopupMenu class of OwnerDrawn_Menu Local ls_Point, ln_X, ln_Y, ln_Return ls_Point = replicate( c0, POINT_Size ) GetCursorPos( @ls_Point ) With This ln_X = .Buff2Num( ls_Point, 1 ) ln_Y = .Buff2Num( ls_Point, 5 ) If .lBind BindEvent( .hWndParent, WM_MEASUREITEM, This, 'PopWndProc' ) BindEvent( .hWndParent, WM_DRAWITEM, This, 'PopWndProc' ) BindEvent( .hWndParent, WM_INITMENUPOPUP, This, 'PopWndProc' ) BindEvent( .hWndParent, WM_UNINITMENUPOPUP, This, 'PopWndProc' ) ** Bind to more messages endif .nMenuPos = -1 && No menu pos for shortcut menu .nOrgProc = GetWindowLong( .hWndParent, GWL_WNDPROC ) ln_Return = TrackPopupMenu( .hPopMenu[1], ; TPM_LEFTALIGN + TPM_TOPALIGN + TPM_RETURNCMD, ; ln_X, ln_Y, 0, .hWndParent, 0 ) If (ln_Return != 0) ln_Return = (ln_Return - .nFirstId) + 1 endif If .lUnBind UnBindEvents( .hWndParent ) endif EndWith Return ln_Return *********************** *** Part of PopWndProc method - PopupMenu class of OwnerDrawn_Menu LParameters th_Wnd as Long, tn_Msg as Long, t_wParam as Long, t_lParam as Long Do case Case (tn_Msg == WM_MEASUREITEM) If (t_wParam == 0) && sent by menu This.OnMeasureMenuItem( th_Wnd, t_lParam ) Return .T. endif Case (tn_Msg == WM_DRAWITEM) If (t_wParam == 0) && sent by menu This.OnDrawMenuItem( t_lParam ) Return .T. endif Case (tn_Msg == WM_INITMENUPOPUP) This.OnInitMenuPopup( t_wParam, t_lParam ) Case (tn_Msg == WM_UNINITMENUPOPUP) This.OnUnInitMenuPopup( t_wParam ) ** Case other messages EndCase Return CallWindowProc( This.nOrgProc, th_Wnd, tn_Msg, t_wParam, t_lParam )Regards