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

조회 수: 15 (최근 30일)
Hank
Hank 2024년 11월 29일
답변: Divyam 2024년 12월 10일 5:43
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
Hitesh
Hitesh 2024년 11월 29일
편집: Hitesh 2024년 11월 29일
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 2024년 11월 29일
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.

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

답변 (1개)

Divyam
Divyam 2024년 12월 10일 5:43
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

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by