在MATLAB中启用/禁用uitab [英] Enable/Disable uitabs in MATLAB

查看:253
本文介绍了在MATLAB中启用/禁用uitab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的GUI的matlab中使用uitab组.但是UItabgroup的一个限制是缺少启用/禁用功能.我试图通过使用来自matlab社区

I'm using uitab group in matlab in my GUI. However one limitation of the UItabgroup is absence of enable/disable feature.I tried to use other alternative by using a function from the matlab communnity findjObject

我使用以下方法通过上述功能进行操作.

I use the following way to do that using the above function.

jtabgroup=findjobj(tabgroup);
jtabgroup.setEnableAt(false); % also I tried turning enable off for 
% for individual tabs using setEnabledAt(1,0) 

我得到以下错误

Undefined function 'setEnabled' for input arguments of type 'handle.handle'.

有人可以帮助我解决此问题,还是建议我启用/停用标签页的其他方法.

Can someone help me with this issue or suggest me some alternative way of enable/disable tabs.

推荐答案

您可以并且应该使用出色的

You can, and should, use a wonderful GUI Layout Toolbox instead of uitab. It allows you to selectively disable tabs out of the box, not to mention the vast array of other useful features. There are two submissions on FEX, one for HG1 (uiextras package) and another for HG2 (uix package, with backward-compatible uiextras interface).

这里是HG2的示例.您需要将TabEnables属性设置为由'on'/'off'值组成的数组,每个选项卡一个(不是最用户友好的API,但是,这比那里的其他任何东西都要好得多).

Here's HG2 example. You need to set TabEnables property to an array of 'on'/'off' values, one per tab (not the most user-friendly API, but hey, that's far better than anything else out there).

f = figure();
p = uix.TabPanel('Parent', f,'Padding', 5);
uicontrol('Style', 'frame', 'Parent', p, 'Background', 'r');
uicontrol('Style', 'frame', 'Parent', p, 'Background', [.8 .8 .8]);
uicontrol('Style', 'frame', 'Parent', p, 'Background', 'g');
p.TabTitles = {'Red', 'Gray', 'Green'};
p.Selection = 2;
p.TabEnables = {'on','on','off'};

另一个建议是求助于纯Java解决方案.显然,这假定您只能将Java组件放置在选项卡中,但是除坐标轴外,几乎任何Matlab UI组件都可以轻松地替换为性能更好的Java对应对象.

Another suggestion would be to resort to pure java solutions. That obviously assumes you can only place java components inside your tabs, but pretty much any Matlab UI component, apart from axes, can be easily replaced with better-behaving and better-looking java counterpart.

这篇关于在MATLAB中启用/禁用uitab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆