Can I change my UIFigure size while maintaining location of elements in figure?
Mostra commenti meno recenti
I have a UIFigure that I want to be interactive. There is a dropdown menu, and depending on the number the user selects, new edit field boxes will appear to match that number. I achieve this by adding length to the figure, making the extra editfield boxes visible (they start off as hidden), then re-positioning everything on the bottom half to be closer to the bottom.

The problem is that when I make the figure taller, the length is added to the bottom (this is fine) but when I make the figure shorter, the length is removed from the top. So if the user selects 5, then goes back to select 1, a lot of my items are now out of frame, because I only adjust the position of the items on the bottom half of the figure.

I could just re-position everything within the figure every time I chane the figures size, but there are 51 elements total between all the hidden/visibile labels and buttons and boxes and such, and that is a lot of stuff to reposition.
Is there a workaround I'm not thinking of where I can repeatedly change the size of my figure without messing up the position of everything? Is there a better way to go about this? I'm on 2019b if that matters.
6 Commenti
Walter Roberson
il 15 Set 2022
when I make the figure taller, the length is added to the bottom
What steps do you take to make the figure taller or shorter?
Amanda Beatty
il 15 Set 2022
Modificato: Amanda Beatty
il 15 Set 2022
Walter Roberson
il 15 Set 2022
So to confirm, you make the figure larger by keeping the same vertical position of the top of the figure, but lowering the bottom, and then moving the buttons to be absolute positions relative to the new bottom?
Taking into account that vertical positions are relative to the bottom of the screen, so y coordinates like in cartesian graphs, increasing y coordinate meaning moving up (whereas some graphics systems instead position relative to the top of the screen with increasing y coordinates meaning moving down from the top.)
If this is correct, then anything you have already added to the figure and which you do not reposition explicitly (like the bottoms) and which is not configured in normalized coordinates, should move down: they should be keeping constant distance from the baseline and the baseline is moving down.
Amanda Beatty
il 15 Set 2022
J. Alex Lee
il 15 Set 2022
Must the figure itself change size when you change your selection? If not, can you make the maximum number of rows of edit boxes in fixed positions and toggle their visibilities depending on your selection?
Amanda Beatty
il 15 Set 2022
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Develop Apps Programmatically in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!