- the figure is created with figure() [or some routine calling figure() that ends up creating a figure]
- the figure is made active by calling figure() and passing in a reference to the figure
- any part of the figure is clicked in (and hit testing is on for any layer of the figure at that location)
Why does gcf in a GUIDE figure give the parent?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Douglas Anderson
il 4 Mar 2022
Modificato: Douglas Anderson
il 4 Mar 2022
Hello,
I've created a number of GUIDE windows called within one app, and one of them I would like to maximize. I have tested that window with a .m test file, and it works fine using
fh = gcf
fh.Window = 'Maximize'
If I insert this in the overarching GUIDE program (that's also a GUIDE figure), it won't maximize because the calling app figure is non-resizable. Obviously I am missing something regarding how the current figure gets passed to the child.
Thoughts? Thanks!
Doug
0 Commenti
Risposta accettata
Walter Roberson
il 4 Mar 2022
A figure becomes the current figure under any of the following circumstances:
If a figure is the current figure and it is deleted, then generally speaking, no other figure will necessarily become the current figure -- they are not defined as "stacking". However, some of the behaviour with creating dialogs such as inputdlg() tends to flow as-if it was going back to the figure that was active at the time the dialog or message was created (those dialogs and pop-up messages are actually figures.) Testing would have to be done to see exactly how that happens.
So... if your overarching GUIDE program is calling into the other GUIDE window because the user clicked something in the overarching GUIDE program... then that overarching GUIDE program became the current figure.
GUIs and figures are the same thing to MATLAB: a GUI is just behaviour attached to a figure, and any figure can have behaviour attached to it.
In your case, if you need the secondary GUIDE program to be able to find its handles by using gcf, then in the overarching program, use figure() passing in the handle of the secondary GUIDE program to make it the current figure.
1 Commento
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!