GUI changes its size

Hi,
using GUIDE I have now my GUI with different pushbuttons. I have the problem that each time I press a button the GUI changes its position. Using debugging I found out that the problem were in the lines where I use the setappdata and getappdata commands. Every time one of these commands is called, the GUI changes its position. At the beggining I wrote a line to define a standard position for my GUI but I deleted it.
What could be the problem?

4 件のコメント

Adam Danz
Adam Danz 2019 年 3 月 14 日
"At the beggining I wrote a line to define a standard position for my GUI but I deleted it"
One possibility is that even though you deleted the line that you think caused the problem, you never recompiled the GUI. You need to close and re-open the GUI for it to use the updated version of the code.
If that's not the problem, you'll need to provide more data. Particularly, the sections of code that affect the set/getappdata.
Ouael Chkoundali
Ouael Chkoundali 2019 年 3 月 15 日
Hi Adam,
thanks for your answer. I closed and re-opened my GUI but I still have the same problem.
Hier is a part from the code:
% --- Executes on button press in pushbutton_browser.
function pushbutton_browser_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton_browser (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%clearLinesFromAxes(handles.axes); %remove all object from the axes
[filename, path] = uigetfile({'*.jpg';'*.png';'*.bmp'},'File Selector'); % choose the image
image = imread([path filename]);
set(handles.text_start_msg, 'visible','off');
axes(handles.axes_display_image)
imshow(image);
matrix = savePixelValues(image);
matrix = calculate_pressure_values(matrix);
setappdata(Pressure_Evaluation, 'matrix', matrix);
The figure changes its position only when the last line is executed.
Rik
Rik 2019 年 3 月 15 日
That is really odd. Can you attach all relevant files?
I also have a strong opinion on the use of GUIDE. You can find my small guide to avoid GUIDE in multiple threads, e.g. here.
Adam Danz
Adam Danz 2019 年 3 月 15 日
"Using debugging I found out that the problem were in the lines where I use the setappdata and getappdata commands"
So the GUI main figure changes position every time you run setappdata and every time you run getappdata? Or does it happen only under certain circumstances? If the problem is reliably reproducible I'd step through the code, line by line, to find the exact line that is causing the displacement. If the displacement is happening within the setappdata or getappdata functions (which aren't open source) the next thing I'd do is carefully look at what I'm setting / getting and play around with those inputs to see if the problem goes away. Lastly, if you think you found a reproducible bug, report it to matlab.

回答 (0 件)

この質問は閉じられています。

タグ

質問済み:

2019 年 3 月 14 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by