uifigure alternatives for gcf, gcbf, gco, gcbo, gca, and any other legacy figure based functions

17 visualizzazioni (ultimi 30 giorni)
Hello, I was wondering if any alternatives that work with the new uifigure windows are being developed for gcf, gcbf, gco, gcbo, gca, and any other legacy functions that used to work with legacy figures (guihandles, for example).

Risposta accettata

Walter Roberson
Walter Roberson il 2 Giu 2023
I used to think that those functions simplify didn't apply to uifigure and children. However someone indicated that the real issue is that by default handle visibility is off for those, and that if you turn handle visibility on that the functions will work. I have not tested this.
  7 Commenti
dpb
dpb il 12 Nov 2025
Modificato: dpb il 14 Nov 2025
Excepting for the uifigure itself, the other objects will still default to 'HandleVisibility','on' so they wouldn't be obscured, anyways. However, it does appear that the builtins are restricted to finding only children of handle-visible figures so the results will depend on the uifigure handle being visible at the time they are calleed.
If the visibility is on, then it appears that would be the case; however, that also leads to the possibility of the problem @Walter Roberson notes above, particularly acute if there's the possibility of user interaction thru a gui that can change focus.
The use of setting the uifigure visibility should probably be restricted to as minimal section of code as is possible and then reset back off in order to avoid that. Locate and save the handle of interest immediately and then use it as the target if calling any of the others. gca on its own will still get a current normal axes if one exists, but if one doesn't, it will create one in a new normal figure, not return the one that may be in the uifigure you just found when not visible.
Stephen23
Stephen23 il 13 Nov 2025
If you want to write repeatable robust code then use explicit object handles.
If you want code that is fragile then use GCF, GCBF, GCO, GCBO, CGA, etc.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by