如题,
  上网搜了一下, 都说用AnyPopup,自己试了一下,  
  不知道为什么, 不管有没有打开菜单, AnyPopup都返回True。请问有没有什么切实有效的解决办法?

解决方案 »

  1.   

    试试在PopupMenu的OnPopup事件里面判断
      

  2.   

    to liangqingzhi
      我这个主要是针对MainMenu, 如果连PopupMenu也能一起实现最好不过。
    而且我用的MainMenu里面没有OnPopup
      

  3.   

    看看这样行不行:
    private
      procedure WMInitMenuPopup(var Msg:TMessage);message WM_INITMENUPOPUP;
      procedure WMUnInitMenuPopup(var Msg:TMessage);message WM_UNINITMENUPOPUP;procedure TForm1.WMInitMenuPopup(var Msg: TMessage);
    begin
      inherited;
      Caption:='Y';
    end;procedure TForm1.WMUnInitMenuPopup(var Msg: TMessage);
    begin
      inherited;
      Caption:='N';
    end;
      

  4.   

    //liangqingzhi的方法不错,完善一下如下  private
        FPopupCount: Integer;
        procedure WMInitMenuPopup(var Msg: TWMInitMenuPopup); message WM_INITMENUPOPUP;
        procedure WMUnInitMenuPopup(var Msg: TWMInitMenuPopup); message WM_UNINITMENUPOPUP;//....
    procedure TForm1.WMInitMenuPopup(var Msg: TWMInitMenuPopup);
    begin
      inherited;
      Inc(FPopupCount);
      Caption := 'Y';
    end;procedure TForm1.WMUnInitMenuPopup(var Msg: TWMInitMenuPopup);
    begin
      inherited;
      Dec(FPopupCount);
      if FPopupCount <= 0 then Caption := 'N';
    end;