Guihandles changes since matlab 2016?

Hey guys,
I am working with Matlab 2018b and trying to run an older code written in Matlab2016b and it doesn't run as it should.
The code itself creates a Gui and instead of showing me the complete Gui with buttons it shows me only the background. I was wondering if something maybe changed in the newest version of matlab. Can anyone help?
Here the code:
function RosGui()
MainFigure = figure('NumberTitle','off','Name','Super Combi Tool','Visible','on','Position',[1,1,1320,762],...
'Units','pixels','Color','k'); %,'ToolBar','none','MenuBar','none'
MainGui = guihandles(MainFigure);
initbuttonimg = imread('Grafiken/InitButton.png');
MainGui.initbutton = uicontrol('Style','pushbutton','Units','pixels','Position',[21,690,117,50],'FontSize',16,'CData',initbuttonimg);
viewbuttonimg = imread('Grafiken/ViewButton.png');
MainGui.viewbutton = uicontrol('Style','pushbutton','Units','pixels','Position',[153,690,48,50],'FontSize',16,'Enable','inactive','CData',viewbuttonimg);
developmentbuttonimg = imread('Grafiken/DevelopmentButtong.png');
MainGui.developmentbutton = uicontrol('Style','pushbutton','Units','pixels','Position',[213,690,135,50],'FontSize',16,'Enable','inactive','CData',developmentbuttonimg);
startbuttonimg = imread('Grafiken/StartButton.png');
MainGui.startstopbutton = uicontrol('Style','pushbutton','Units','pixels','Position',[794,690,48,50],'CData',startbuttonimg,'FontSize',16,'Enable','inactive');
stopbuttonimg = imread('Grafiken/StopButton.png');
MainGui.stopbutton = uicontrol('Style','pushbutton','Units','pixels','Position',[866,690,48,50],'CData',stopbuttonimg,'FontSize',16,'Enable','inactive');
savebuttonimg = imread('Grafiken/savebutton.png');
MainGui.savebutton = uicontrol('Style','pushbutton','Units','pixels','Position',[929,690,48,50],'CData',savebuttonimg,'FontSize',16,'Enable','inactive');
resetbuttonimg = imread('Grafiken/reset.png');
MainGui.resetbutton = uicontrol('Style','pushbutton','Units','pixels','Position',[992,690,48,50],'CData',resetbuttonimg,'FontSize',16,'Enable','inactive');
MainGui.startcover = axes('Units','pixels','Position',[20,20,1280,660]);
% Startcover initialisieren
start_figure = imread('Grafiken/start_cover.png');
imshow(start_figure,'Parent',MainGui.startcover);
% GuiData speichern
guidata(MainFigure,MainGui);
set(MainFigure,'Visible','on');
end

4 commentaires

Geoff Hayes
Geoff Hayes le 24 Avr 2020
Ottavia - what happens if you step through the code with the MATLAB debugger? Are there any errors in the console logs?
Walter Roberson
Walter Roberson le 24 Avr 2020
search Answers for tag:always-parent
Ottavia Rossini
Ottavia Rossini le 27 Avr 2020
Hey,
There were no errors but I found the mistake.
In the code the position of push buttons is given in pixels, therefore using another screen would make them disappear.
Thank you for your help though!
Walter Roberson
Walter Roberson le 27 Avr 2020
also if you happen to be using a high resolution display on Mac or Windows, then the meaning of pixels units changed from physical to 1/72 inch or 1/100 inch (like the "points" unit)

Réponses (0)

Cette question est clôturée.

Produits

Version

R2018b

Clôturé :

le 20 Août 2021

Community Treasure Hunt

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

Start Hunting!

Translated by