gui programticly , issue with uipanel

조회 수: 3 (최근 30일)
Aleksander
Aleksander 2013년 6월 26일
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