GUI Elements Changing Position on Subsequent Executions

6 ビュー (過去 30 日間)
Jeremy
Jeremy 2018 年 4 月 16 日
コメント済み: Adam Danz 2021 年 6 月 10 日
I have a GUI that contains three buttons and two plot axes. When I run it the first time, the positions of the elements is off a bit, with certain elements are off-center - horizontally or vertically (see below).
If I close this window and run the code again, everything is as it should be:
Here is the code that generates all of the UI elements:
% Create the app window
app = figure(...
'Position', [0, 0, 750, 875],...
'MenuBar', 'none',...
'ToolBar', 'none',...
'Resize', 'Off',...
'NumberTitle', 'Off',...
'Name', 'CBT Field Curvature'...
);
movegui('center');
% Plot Data
axesH = axes(...
'Units', 'Pixels',...
'Position', [25, 425, 700, 375]...
);
set(gca,'xtick',[])
set(gca,'ytick',[])
set(gca,'XColor','none')
set(gca,'YColor','none')
% Plot Data
axesV = axes(...
'Units', 'Pixels',...
'Position', [25, 25, 700, 375]...
);
% Choose Images File Button
uicontrol(...
'Style', 'pushbutton',...
'Position', [25, 825, 100, 25],...
'String', 'Choose Images',...
'Callback', @chooseImages_Callback...
);
% Choose Positions File Button
uicontrol(...
'Style', 'pushbutton',...
'Position', [150, 825, 100, 25],...
'String', 'Choose Positions',...
'Callback', @choosePositions_Callback...
);
% Save Button
uicontrol(...
'Style', 'pushbutton',...
'Position', [275, 825, 100, 25],...
'String', 'Save',...
'Callback', @saveButton_Callback...
); end
  3 件のコメント
Jeremy
Jeremy 2021 年 6 月 10 日
Unfortunately not. I think I just lived with it before eventually switching all of my app development to Python.
Adam Danz
Adam Danz 2021 年 6 月 10 日
The problem is likely within the callback functions so we can't diagnose the problem without seeing where the problem is likely having.

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

回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by