Home > m > gui > ltpdv > callbacks > ltpdv_properties_build_props.m

ltpdv_properties_build_props

PURPOSE ^

Object class

SYNOPSIS ^

function ltpdv_properties_build_props(obj, mainfig)

DESCRIPTION ^

 Object class

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ltpdv_properties_build_props(obj, mainfig)
0002 
0003   % Object class
0004   cl = class(obj);
0005 
0006   % Get setter methods
0007   ms = methods(cl);
0008   setters = ms(strmatch('set', ms));
0009 
0010   % Draw properties panel
0011   panh = findobj(mainfig, 'Tag', 'LTPDVobjectProperties');
0012   delete(get(panh, 'Children'))
0013 
0014   pmarg = 0.025;
0015   keyl = pmarg;
0016   keyh = 0.055;
0017   keyw = 0.3;
0018   keyb = 1-pmarg-keyh;
0019   vall = pmarg*2 + keyw;
0020   valw = 0.5;
0021   oldVals = {};
0022   for kk=1:numel(setters)
0023 
0024     sfcn = setters{kk};
0025     prop = lower(strrep(sfcn, 'set', ''));
0026     val = [];
0027     try
0028       val  = obj.(prop);
0029     end
0030     if isa(val, 'ltpda_obj')
0031       val = char(val);
0032     end
0033     if isa(val, 'sym')
0034       val = char(val);
0035     end
0036     if ~isnumeric(val)
0037       oldVals = [oldVals {val}];
0038       % Draw label
0039       sth = uicontrol(panh,'Style','text',...
0040         'String', sfcn,...
0041         'Units', 'normalized', ...
0042         'BackgroundColor', 'w', ...
0043         'Fontsize', 12, ...
0044         'Position',[keyl keyb keyw keyh]);
0045 
0046       % Draw edit box
0047       eh = uicontrol(panh,'Style','edit',...
0048         'String', val,...
0049         'units', 'normalized', ...
0050         'BackgroundColor', 'w', ...
0051         'Fontsize', 12, ...
0052         'Enable', 'on', ...
0053         'Position',[vall keyb valw keyh]);
0054 
0055       keyb = keyb - pmarg - keyh;
0056     end
0057   end
0058   % Draw apply button
0059   pbh = uicontrol(panh,'Style','pushbutton',...
0060     'String','Apply',...
0061     'Callback', {@ltpdv_properties_apply, oldVals, obj, mainfig}, ...
0062     'Units', 'normalized', ...
0063     'Fontsize', 12, ...
0064     'Position',[pmarg pmarg 0.15 0.05]);
0065 
0066 end

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003