【问题标题】:Matlab Context Menu and Buttondown function ConflictMatlab上下文菜单和Buttondown函数冲突
【发布时间】:2015-07-27 16:03:16
【问题描述】:

我正在使用指南在 Matlab 中制作 GUI。我希望 GUI 中的主轴在鼠标左键单击时执行任务,并通过右键单击显示上下文菜单。我们可以在 Matlab 中做吗?

我想到的一个想法是识别鼠标点击并使用命令显示上下文菜单。 Matlab 中是否有执行此操作的命令?

【问题讨论】:

标签: matlab contextmenu matlab-guide axes


【解决方案1】:

您的所有问题都可以在 Matlab 中进行。要以编程方式创建上下文菜单,您可以阅读更多 here

如果您使用的是 GUIDE,那么您可以在 Tools / Menu Editor / Context Menus 下创建上下文菜单以及相应的回调函数。

顺便说一句,你应该首先使用this perfect tool,那里有很多例子!!!

【讨论】:

    【解决方案2】:

    我通过在主轴buttondownfcn回调中使用以下代码解决了这个问题。

    if strcmp( get(handles.figure1,'selectionType') , 'normal')
         myfunction();
    end
    
    if strcmp( get(handles.figure1,'selectionType') , 'open')
        mainaxes_contextmenu.Visible = 'on';
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-31
      • 2016-05-04
      • 2012-07-31
      相关资源
      最近更新 更多