gui programticly , issue with uipanel

1 Ansicht (letzte 30 Tage)
Aleksander
Aleksander am 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 Kommentare
Jan
Jan am 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 am 26 Jun. 2013
Thanks for the tips, i am a novice when it comes to matlab, so this realy helps :)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Tom
Tom am 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

Weitere Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by