set GUI position, jumps back to former position
Mostra commenti meno recenti
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?
1 Commento
Gerrit
il 5 Feb 2014
Risposte (0)
Categorie
Scopri di più su Mathematics in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!