Matlab中uitabpanel之间的平滑过渡(光学效果)

发布于 2024-11-14 05:02:38 字数 1443 浏览 4 评论 0原文

我设计了一组三个 uitabpanels 对象。

  htab = uitabgroup('v0');
  th1 = uitab('v0',htab,'title','Panel 1','ButtonDownFcn',...
      @th1_ButtonDownFcn);
  th2 = uitab('v0',htab,'title','Panel 2','ButtonDownFcn',...
      @th2_ButtonDownFcn);
  th3 = uitab('v0',htab,'title','Panel 3','ButtonDownFcn',...
      @th3_ButtonDownFcn);

我的目的是当我通过鼠标单击更改选定的 uipanel 时,在它们之间实现平滑过渡。我假装通过使用 ButtonDownFcn 函数更改其中包含的元素的“可见”属性来实现它(我根据 此页面)。

    set(handles.th2,'Visible','off');
    set(handles.th3,'Visible','off');
...
  function th1_ButtonDownFcn(hObject, eventdata)
  handles = guidata(fh);
  set(handles.th1,'Visible','on');
  set(handles.th2,'Visible','off');
  set(handles.th3,'Visible','off'); 
  guidata(fh,handles);
  end

  function th2_ButtonDownFcn(hObject, eventdata)
  handles = guidata(fh);
  set(handles.th1,'Visible','off');
  set(handles.th2,'Visible','on'); 
  set(handles.th3,'Visible','off');
  guidata(fh,handles);
  end

  function th3_ButtonDownFcn(hObject, eventdata)
  handles = guidata(fh);
  set(handles.th1,'Visible','off');
  set(handles.th2,'Visible','off');
  set(handles.th3,'Visible','on');
  guidata(fh,handles);      
  end

其中

fh:包含 uitabpanels 的图窗的句柄。

handles.th1、handles.th2、handles.th3:分别包含在每个 uitabpanel 中的元素的句柄。

但是,它没有起作用(我单击 uitabpanel 的每个选项卡,它们的可见性没有改变),我不明白为什么。

I have designed a group of three uitabpanels objects.

  htab = uitabgroup('v0');
  th1 = uitab('v0',htab,'title','Panel 1','ButtonDownFcn',...
      @th1_ButtonDownFcn);
  th2 = uitab('v0',htab,'title','Panel 2','ButtonDownFcn',...
      @th2_ButtonDownFcn);
  th3 = uitab('v0',htab,'title','Panel 3','ButtonDownFcn',...
      @th3_ButtonDownFcn);

My intention is having a smooth transition between them when I change the selected uipanel through the mouse click. I pretend to achieve it changing the 'Visible' property of the elements contained inside them using the ButtonDownFcn function ( I got this idea based on the description section of this page).

    set(handles.th2,'Visible','off');
    set(handles.th3,'Visible','off');
...
  function th1_ButtonDownFcn(hObject, eventdata)
  handles = guidata(fh);
  set(handles.th1,'Visible','on');
  set(handles.th2,'Visible','off');
  set(handles.th3,'Visible','off'); 
  guidata(fh,handles);
  end

  function th2_ButtonDownFcn(hObject, eventdata)
  handles = guidata(fh);
  set(handles.th1,'Visible','off');
  set(handles.th2,'Visible','on'); 
  set(handles.th3,'Visible','off');
  guidata(fh,handles);
  end

  function th3_ButtonDownFcn(hObject, eventdata)
  handles = guidata(fh);
  set(handles.th1,'Visible','off');
  set(handles.th2,'Visible','off');
  set(handles.th3,'Visible','on');
  guidata(fh,handles);      
  end

where

fh: handle of the figure where they are contained the uitabpanels.

handles.th1, handles.th2, handles.th3: handles of the elements contained into each uitabpanel respectively.

However, it has not worked (I click on each one of uitabpanel's tabs and the visibility of them do not change) and I do not understand why.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

神妖 2024-11-21 05:02:38

总之,当您单击选项卡的标签时,UITAB 的 ButtonDownFcn 和 SelectionChangeFcn 函数已经处于活动状态。因此不可能达到预期的目标(平滑的光学过渡),因为获得的结果(修改上述功能)与不执行任何操作相同。

In conclusion, the ButtonDownFcn and SelectionChangeFcn functions of an UITAB are already active when you click in the tab´s label. So it is not possible to achieve the desired target (smooth optical transition) because the obtained result (modifying the mentioned functions) is the same that doing nothing.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文