MATLAB: Are panels/buttons missing in GUIDE but visible in the GUI

guidematlab guimissing elements

I got a source code for a GUI that is used with matlab version 2013b. Now, I am supposed to do some changes to this GUI and to use it with version 2015a. I also have the same problems as have been reported (and solved) earlier: panels hiding text fields and buttons (see e. g. the "Gun" panel in the attached screenshot). I know how to solve this.
But there is another problem that I haven't found any reference to/solution for: When I run my GUI from within GUIDE I see panels and buttons (marked by red rectangles) that are not visible in GUIDE. I ran the "matlab graphics finder" app and it tells me that many text fields and buttons are hidden behind the "Gun" panel but if I don't even see the panels in GUIDE I cannot switch the layers, that is, send panel to back, etc. Also, when I use the object browser in GUIDE I don't see these panels and buttons but they are created when I run the figure, so, these objects should be there. But, in GUIDE, they are not.
Can anybody tell me what is going on here? Help is greatly appreciated.

Best Answer

GUIDE only shows graphics objects that are created through GUIDE. Graphics objects that are created on-the-fly will not show up. Look through the code for places where uicontrol() is called: any call to uicontrol is probably creating a new graphics object.
(The only case where uicontrol does not create a new graphics object is if you pass uicontrol() the handle to an existing uicontrol, and nothing else: that particular syntax means that the given uicontrol is to be given the focus.)