set GUI position, jumps back to former position

1 回表示 (過去 30 日間)
Gerrit
Gerrit 2014 年 2 月 5 日
コメント済み: Gerrit 2014 年 2 月 5 日
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 件のコメント
Gerrit
Gerrit 2014 年 2 月 5 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeHistorical Contests についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by