GUI freezes after deleting a Tab
I’ve got 6 Tabs in GUI, but one is hidden in the startup fcn. Hidden tab called "Hybrid" is used when user wants to change the engine from Solid one to Hybrid – if so, the Solid one is hidden and the Hybrid appears.
Problem description: I’m using the Browse button (e.g. in Solid tab) right when I start the GUI, and it works – file is imported to GUI, and the Label shows the title of the file. But when I change from Solid to Hybrid and then from Hybrid to Solid again, this button does not work – browse pop up is shown, I choose the file, but then there’s no title in the Label, the whole app designer does not respond (+ there is an error sound wherever I click with my mouse, but no errors in the command window).
To hide tabs I’ve used one of the solutions in Matlab Answer which was to add 2 lines in startupfcn:
app.tg = matlab.ui.container.TabGroup;
app.TabGroup.Children(2).Parent = app.tg;
app.iteration=1;
User can switch between the tabs using both:
1) 2 buttons, "SolidToHybrid", "HybridToSolid" – and their callback:
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
2) 2 Switches with the same callback:
if mod(app.iteration, 2) == 0
value = app.Switch.Value;
else
value = app.Switch_2.Value;
end
app.iteration=app.iteration+1;
if strcmp(value,’Hybrid’)
app.Switch.Value="Hybrid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
else
app.Switch_2.Value="Solid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
end
this "deletes" all tabs that are to the right and adding the chosen one + the deleted rest in the correct order.
The order of tabs: "First", "Solid", ("Hybrid"), "Fourth", "Fifth", "Sixth"
I’ve chosen 2 options to eliminate e.g. infinite loops connected with switch (I thought it could be a problem), but it seems like there’s a different problem since in both cases "Browsing files" does not work.
Edit: Maybe there’s a different, easier way to hide Tabs but with the similar outcome – always only one is visible.I’ve got 6 Tabs in GUI, but one is hidden in the startup fcn. Hidden tab called "Hybrid" is used when user wants to change the engine from Solid one to Hybrid – if so, the Solid one is hidden and the Hybrid appears.
Problem description: I’m using the Browse button (e.g. in Solid tab) right when I start the GUI, and it works – file is imported to GUI, and the Label shows the title of the file. But when I change from Solid to Hybrid and then from Hybrid to Solid again, this button does not work – browse pop up is shown, I choose the file, but then there’s no title in the Label, the whole app designer does not respond (+ there is an error sound wherever I click with my mouse, but no errors in the command window).
To hide tabs I’ve used one of the solutions in Matlab Answer which was to add 2 lines in startupfcn:
app.tg = matlab.ui.container.TabGroup;
app.TabGroup.Children(2).Parent = app.tg;
app.iteration=1;
User can switch between the tabs using both:
1) 2 buttons, "SolidToHybrid", "HybridToSolid" – and their callback:
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
2) 2 Switches with the same callback:
if mod(app.iteration, 2) == 0
value = app.Switch.Value;
else
value = app.Switch_2.Value;
end
app.iteration=app.iteration+1;
if strcmp(value,’Hybrid’)
app.Switch.Value="Hybrid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
else
app.Switch_2.Value="Solid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
end
this "deletes" all tabs that are to the right and adding the chosen one + the deleted rest in the correct order.
The order of tabs: "First", "Solid", ("Hybrid"), "Fourth", "Fifth", "Sixth"
I’ve chosen 2 options to eliminate e.g. infinite loops connected with switch (I thought it could be a problem), but it seems like there’s a different problem since in both cases "Browsing files" does not work.
Edit: Maybe there’s a different, easier way to hide Tabs but with the similar outcome – always only one is visible. I’ve got 6 Tabs in GUI, but one is hidden in the startup fcn. Hidden tab called "Hybrid" is used when user wants to change the engine from Solid one to Hybrid – if so, the Solid one is hidden and the Hybrid appears.
Problem description: I’m using the Browse button (e.g. in Solid tab) right when I start the GUI, and it works – file is imported to GUI, and the Label shows the title of the file. But when I change from Solid to Hybrid and then from Hybrid to Solid again, this button does not work – browse pop up is shown, I choose the file, but then there’s no title in the Label, the whole app designer does not respond (+ there is an error sound wherever I click with my mouse, but no errors in the command window).
To hide tabs I’ve used one of the solutions in Matlab Answer which was to add 2 lines in startupfcn:
app.tg = matlab.ui.container.TabGroup;
app.TabGroup.Children(2).Parent = app.tg;
app.iteration=1;
User can switch between the tabs using both:
1) 2 buttons, "SolidToHybrid", "HybridToSolid" – and their callback:
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
2) 2 Switches with the same callback:
if mod(app.iteration, 2) == 0
value = app.Switch.Value;
else
value = app.Switch_2.Value;
end
app.iteration=app.iteration+1;
if strcmp(value,’Hybrid’)
app.Switch.Value="Hybrid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
else
app.Switch_2.Value="Solid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
end
this "deletes" all tabs that are to the right and adding the chosen one + the deleted rest in the correct order.
The order of tabs: "First", "Solid", ("Hybrid"), "Fourth", "Fifth", "Sixth"
I’ve chosen 2 options to eliminate e.g. infinite loops connected with switch (I thought it could be a problem), but it seems like there’s a different problem since in both cases "Browsing files" does not work.
Edit: Maybe there’s a different, easier way to hide Tabs but with the similar outcome – always only one is visible. gui, app designer MATLAB Answers — New Questions