Skip to content
Snippets Groups Projects
Verified Commit 5042d9d0 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

fix bug where if a tab was opened when it was already open an error was...

fix bug where if a tab was opened when it was already open an error was created and nothing happened
parent fbbc1f8c
No related branches found
No related tags found
No related merge requests found
...@@ -34,17 +34,7 @@ function [newTab, created] = add_tab(hObject, title) ...@@ -34,17 +34,7 @@ function [newTab, created] = add_tab(hObject, title)
handles = guidata(hObject); handles = guidata(hObject);
if isfield(handles, 'tabGroup') == 0 if isfield(handles, 'tabGroup') == 0
handles = createTabGroup(handles, hObject);
hTabGroup = uitabgroup(handles.figure1,'Position',[0 0 1 1]); %, 'SelectionChangeFcn', {@selection_tab_changed});
panel = handles.uipanel_welcome;
set(panel,'Visible','off');
drawnow;
handles.tabGroup = hTabGroup;
setappdata(0,'tabGroup', hTabGroup);
% Update handles structure
guidata(hObject, handles);
end end
created = 1; created = 1;
...@@ -55,10 +45,11 @@ tab = checkIfExistsTab(tabGroup, title); ...@@ -55,10 +45,11 @@ tab = checkIfExistsTab(tabGroup, title);
if ~isempty(tab) if ~isempty(tab)
% close existing tab so that it'll be redrawn % close existing tab so that it'll be redrawn
gui_tabs.delete_tab(tab); gui_tabs.delete_tab(tab);
% set(handles.tabGroup, 'SelectedTab' , tab); tabGroup = getappdata(0, 'tabGroup');
% newTab = tab; if isempty(tabGroup)
% created = 0; handles = createTabGroup(handles, hObject);
% return; tabGroup = getappdata(0, 'tabGroup');
end
end end
newTab = uitab(handles.tabGroup, 'Title', title); newTab = uitab(handles.tabGroup, 'Title', title);
...@@ -80,3 +71,16 @@ setappdata(0, 'tabGroup', tabGroup); ...@@ -80,3 +71,16 @@ setappdata(0, 'tabGroup', tabGroup);
end end
end end
end end
function handles = createTabGroup(handles, hObject)
hTabGroup = uitabgroup(handles.figure1,'Position',[0 0 1 1]); %, 'SelectionChangeFcn', {@selection_tab_changed});
panel = handles.uipanel_welcome;
set(panel,'Visible','off');
drawnow;
handles.tabGroup = hTabGroup;
setappdata(0,'tabGroup', hTabGroup);
% Update handles structure
guidata(hObject, handles);
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment