How to stop tabs in a figure jumping back and forth.

2 Ansichten (letzte 30 Tage)
Hank
Hank am 29 Nov. 2024
Beantwortet: Divyam am 10 Dez. 2024
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 Kommentare
Hitesh
Hitesh am 29 Nov. 2024
Bearbeitet: Hitesh am 29 Nov. 2024
Hi @Hank,
Could you please share your code or MATLAB file that will help reproduce this issue, so I can look for the root cause?
Hank
Hank am 29 Nov. 2024
That is not practical. My code to draw those many subplots is very big and I don't want to share that.
Additionally, you would need a lot of measurement input data to reproduce the problem. And I'm not going to share that either.
It would be great if someone recognises the problem and had a solution.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Divyam
Divyam am 10 Dez. 2024
Hi @Hank,
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

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by