- 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 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2022-3-4
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!