Info

此问题已关闭。 请重新打开它进行编辑或回答。

Guihandles changes since matlab 2016?

1 次查看(过去 30 天)
Ottavia Rossini
Ottavia Rossini 2020-4-24
关闭: MATLAB Answer Bot 2021-8-20
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 个评论
Ottavia Rossini
Ottavia Rossini 2020-4-27
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 2020-4-27
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)

回答(0 个)

此问题已关闭。

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by