Smooth transition (optical effect) between uitabpanels

조회 수: 2 (최근 30일)
Julián Francisco
Julián Francisco 2011년 6월 6일
Hi. 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 optical 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 http://www.mathworks.com/matlabcentral/fileexchange/4780-tab-panel-yet-another-one).
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.

채택된 답변

Julián Francisco
Julián Francisco 2011년 6월 8일
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.

추가 답변 (1개)

Jan
Jan 2011년 6월 6일
The ButtonDownFcn of a UITAB is triggered, if you click in the tab's contents area. I assume you want to use the SelectionChangeFcn function of the UITABGROUP to detected a changed active tab.
  댓글 수: 3
Jan
Jan 2011년 6월 6일
@Julian: I admit, I do not get the point of "smooth transition". Do you mean an optical effect?
Julián Francisco
Julián Francisco 2011년 6월 6일
@Jan Simon: Yes, Jan. I refer to that. It is my fault. I should have written "smooth optical transition..." in the title of the question. Sorry. Thank you for your correction. Cheers.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by