I just used the same code for a smaller version and it works. I have no idea why, though. It even does the same thing in the gui_mainfcn. It executes that line 234 and even the value of the variable gui_Visible which seems to be the only thing that could be changed in that line is the same (value is auto). I don't see what's going on here.
set GUI position, jumps back to former position
1 view (last 30 days)
Show older comments
Hey, I've created two GUIs. The first one closes when the second one opens. Now, I want the second GUI to be in the same position as the first one when closed. It shortly works, but it then moves into its default-position (where the first GUI was opened).
I've written the following code in the first GUI just before calling the second one: Position = get(gcf,'OuterPosition'); setappdata(0,'Position',Position);
What I've got in the second GUI's OpeningFcn is Position = getappdata(0,'Position'); set(gcf,'OuterPosition',Position);
I've debugged the code and what happens is: set(gcf,'OuterPosition',Position) does work. After the OpeningFcn, the gui_mainfcn is called automatically. The follownig code is from line 233 to 237 of the gui_mainfcn:
if ~gui_Exported
gui_hFigure = local_openfig(gui_State.gui_Name, 'reuse',gui_Visible);
elseif ~isempty(gui_VisibleInput)
set(gui_hFigure,'Visible',gui_VisibleInput);
end
The variable gui_Exported is FALSE so Line 234 is being executed. After that command the GUI moves back into its default-position.
So what does line 234 excactly do? And what's the variable gui_Exported? How could I solve this issue by editing the gui_mainfcn? I assume you're not meant to edit the gui_mainfcn, though. Any ideas how to solve this one?
Answers (0)
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!