gui programticly , issue with uipanel

1 次查看(过去 30 天)
hi. i have a issue when creating a gui programaticly, the uipanel will not show it`s borders, and also not the title.
the code:
% code
function varargout = multi_tool(varargin)
%ensure this appliction has the only window
close all
clear all
%open the main gui window
try
handles.mainfig = figure('menu','none','toolbar','figure','units','normalized','outerposition',[0 0 1 1])
catch
disp 'error with setting screen size for the application'
end
%determine size of the created figure
set(gcf,'units','pixels')
fig_size = get(gcf,'position')
%create panel to contain the bellow buttons
handles.pan1 = uipanel('parent',handles.mainfig,'BorderType','etchedout','Title','PLEASE SELECT FROM BELLOW OPTION','FontSize',12,'position',[0 0 fig_size(3)*1 fig_size(4)*1])
pan1_size = get(handles.pan1,'position')
%create selection buttons
handles.But1 = uicontrol('parent',handles.pan1,'Style','pushbutton','String','APP LAUNCHER','Position',[pan1_size(3)*0.05 pan1_size(4)*0.88 pan1_size(3)*0.9 pan1_size(4)*0.1])
set(handles.But1, 'callback', {@applauncher, handles})
handles.But2 = uicontrol('parent',handles.pan1,'Style','pushbutton','String','DEBUGING TOOLS','Position',[pan1_size(3)*0.05 pan1_size(4)*0.68 pan1_size(3)*0.9 pan1_size(4)*0.1])
set(handles.But2, 'callback', {@Debuging_Tools, handles})
handles.But3 = uicontrol('parent',handles.pan1,'Style','pushbutton','String','YAW COMPANSATED ROLL/PITCH CALCULATOR','Position',[pan1_size(3)*0.05 pan1_size(4)*0.48 pan1_size(3)*0.9 pan1_size(4)*0.1])
handles.But4 = uicontrol('parent',handles.pan1,'Style','pushbutton','String','HMS, HELIDECK MRU CALCULATOR','Position',[pan1_size(3)*0.05 pan1_size(4)*0.28 pan1_size(3)*0.9 pan1_size(4)*0.1])
end
end
  2 个评论
Jan
Jan 2013-6-26
clear all on top of a function is a pure waste of time: There cannot be any benefit for deleting formerly created variables, because functions have their own workspace, which is clean and free at the beginning. In addition the brute clearing removes all breakpoints, such that a debugging is impeded massively. Finally removing all loaded functions from the memory requires a time-consuming reloading from the disk. Therefore I recommend, to avoid clear all under all cirdumstances.
Aleksander
Aleksander 2013-6-26
Thanks for the tips, i am a novice when it comes to matlab, so this realy helps :)

请先登录,再进行评论。

采纳的回答

Tom
Tom 2013-6-26
It is there, but it's off the screen because of the units: if you set the uipanel Units field to 'Pixels' before you set the position, it should appear

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by