Hide Tab In Matlab App Designer
Unfortunately, as reported in the comments, the uitab
does not have a enable
property.
This is the list of the iutab
object:
BackgroundColor BeingDeleted BusyAction ButtonDownFcn Children CreateFcn DeleteFcn ForegroundColor HandleVisibility Interruptible Parent Position SizeChangedFcn Tag Title TooltipString Type UIContextMenu Units UserData
A possible workaround could be to enable / disable the uicontrols
belonging to the uitab
.
You can get the list of uicontrols
of a uitab
since they handles are stored in the children
property.
Once you have the handles, you can set their enable
property to either on
or off
.
In the following code:
- a
uitabgroup
is created including twoiutab
- in each
iutab
someuicontrols
are added with the initialenable
status set to 'off` - in the figure, two
checkbox
are added to enable / disable theuicontrols
of the twouitab
The functin that get the hanles and enable / disable the uicontrols
has been directly written as callbak
of the checkbox
% Create a Figure f = figure; % Add a uitabgroup tabgp = uitabgroup(f,'Position',[.05 .05 .3 .8]); % Add two uitab tab1 = uitab(tabgp,'Title','Tab #1'); tab2 = uitab(tabgp,'Title','Tab #2'); % Add some uicontrols to the first uitab (initial status = disabled) % Add a Pushbutton uicontrol('parent',tab1,'style','pushbutton','unit','normalized', ... 'position',[.1 .1 .3 .1],'string','OK','enable','off') % Add a checkbox uicontrol('parent',tab1,'style','checkbox','unit','normalized', ... 'position',[.1 .3 .6 .1],'string','Checkbox #1','enable','off') % Add a radiobutton uicontrol('parent',tab1,'style','radio','unit','normalized', ... 'position',[.1 .6 .5 .1],'string','Radio #1','enable','off') % Add another radiobutton uicontrol('parent',tab1,'style','radio','unit','normalized', ... 'position',[.1 .5 .5 .1],'string','Radio #2','enable','off') % Add some uicontrols to the first uitab % Add a Pushbutton uicontrol('parent',tab2,'style','pushbutton','unit','normalized', ... 'position',[.1 .1 .3 .1],'string','OK','enable','off') % Add a checkbox uicontrol('parent',tab2,'style','checkbox','unit','normalized', ... 'position',[.1 .3 .6 .1],'string','Checkbox #1','enable','off') % Add a radiobutton uicontrol('parent',tab2,'style','radio','unit','normalized', ... 'position',[.1 .6 .5 .1],'string','Radio #1','enable','off') % Add another radiobutton uicontrol('parent',tab2,'style','radio','unit','normalized', ... 'position',[.1 .5 .5 .1],'string','Radio #2','enable','off') % Add two checkbox to the Figure to enable / disable the uicontrols in the % uitab uicontrol('parent',f,'style','checkbox','unit','normalized', ... 'position',[.4 .3 .6 .1],'string','Enable Tab 1 uicontrols', ... 'callback','tab1_c=get(tab1,''children'');e_d=''off'';if(get(gcbo,''value'') == 1) e_d=''on''; end;set(tab1_c(:),''Enable'',e_d)') uicontrol('parent',f,'style','checkbox','unit','normalized', ... 'position',[.4 .4 .6 .1],'string','Enable Tab 2 uicontrols', ... 'callback','tab2_c=get(tab2,''children'');e_d=''off'';if(get(gcbo,''value'') == 1) e_d=''on''; end;set(tab2_c(:),''Enable'',e_d)')
Hope this helps.
Qapla'
Hide Tab In Matlab App Designer
Source: https://stackoverflow.com/questions/37432008/enable-disable-uitabs-in-matlab
Posted by: crawfordwheabion.blogspot.com
0 Response to "Hide Tab In Matlab App Designer"
Post a Comment