MATLAB Answers

gui programticly , issue with uipanel

조회 수: 5(최근 30일)
Aleksander
Aleksander 26 Jun 2013
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 26 Jun 2013
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 26 Jun 2013
Thanks for the tips, i am a novice when it comes to matlab, so this realy helps :)

로그인 to comment.

채택된 답변

Tom
Tom 26 Jun 2013
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

로그인 to comment.

More Answers (0)

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by