How to stop tabs in a figure jumping back and forth.
15 views (last 30 days)
Show older comments
In MatLab I use figure, uitabgroup and uitab to create many plots in one figure. Some figures have 4 levels of tabs.
When the figure appears, the focus often jumps suddenly to another subtab without me using any controls. So when looking at the plot of one subtab suddenly the figure shows another subtab with its plot without me clicking on anything (like I clicked on that subtab, which I didn't).
My theory is that this happens because the plot in that other subtab has finished rendering and then is shown on top.
This is very annoying and impractical. How can I prevent this ?
2 Comments
Answers (1)
Divyam
on 10 Dec 2024 at 5:43
As you have correctly identified, the reason for the sudden shift in focus is due to the creation and rendering of a new sub-tab. When a new child is appended to the list of children of a parent tab, the order of displaying the tabs on the screen becomes dependent on the list of children. Hence, as new children are appended to this list and rendered, the focus is bound to shift.
Since I am unaware of the tab hierarchy induced by your code, I would suggest waiting for all the plots to finish rendering before focusing on a plot.
Another workaround that could work is using the "focus" function on the UI component that you wish to view while the other tabs are rendering. This would ensure that the figure for which the "focus" function is called is displayed on top of all the other figures.
For more information regarding the "focus" function, refer to this documentation: https://www.mathworks.com/help/matlab/ref/matlab.ui.figure.focus.html
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!