iluke_controls

PURPOSE ^

SYNOPSIS ^

function s = iluke_controls(h,s,sname,list,titlestring,vertpos,style)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function s = iluke_controls(h,s,sname,list,titlestring,vertpos,style)
0002 
0003 fieldnames = {'title','import','make','modify','load','save','run','clear','reset','test','disp','export','text'};
0004 strings = {titlestring,'Import','New','Modify','Load','Save','Run','Clear','Reset','Test','Disp','Export',''};
0005 styles = {'Text','pushbutton','pushbutton','pushbutton','pushbutton','pushbutton','pushbutton','pushbutton','pushbutton','pushbutton','pushbutton','pushbutton','Text'};
0006 %
0007 butwidthcorr = style.butwidth + style.buthsep;
0008 titlewidthcorr = style.buthsep + (style.titlewidth + style.buthsep);
0009 infowidth = style.panelwidth - titlewidthcorr - 5*butwidthcorr - style.buthsep;
0010 %
0011 s.(sname) = struct;
0012 for ilist = 1:length(list),
0013     if ~isempty(list{ilist}),
0014         fname = list{ilist};
0015         s.(sname).(fname) = struct;
0016         %
0017         ifield = find(strcmp(fieldnames,fname));
0018         %
0019         if ~isempty(ifield),
0020             fstyle = styles{ifield};
0021             fstring = strings{ifield};
0022         else
0023             fstyle = 'pushbutton';
0024             fstring = fname;
0025         end            
0026         positionindex = ilist;
0027         %
0028         if positionindex == 1,%title
0029             next = find(~strcmp(list(2:end),''),1,'first') - 1;% number of button space occupied by title
0030             fposition = [style.buthsep,vertpos + style.textheightcorr,style.titlewidth + next*butwidthcorr,style.textheight];
0031         elseif positionindex == 7,%text
0032             next = 6 - find(~strcmp(list(1:end-1),''),1,'last');% number of button space occupied by title
0033             fposition = [titlewidthcorr + (positionindex - 2 - next)*butwidthcorr,vertpos + style.textheightcorr,infowidth +  next*butwidthcorr,style.textheight];
0034         else %pushbutton
0035             fposition = [titlewidthcorr + (positionindex - 2)*butwidthcorr,vertpos,style.butwidth,style.butheight];
0036         end
0037         %
0038         s.(sname).(fname).handle = uicontrol(h,'Style',fstyle,'String',fstring,'Position',fposition,'FontName',style.fontname,'FontUnits','pixels','FontSize',style.fontsize);
0039         if strcmp(fstyle,'pushbutton'),
0040             set(s.(sname).(fname).handle,'Callback',['action = ''',sname,fname,''';iluke_callbacks;']);
0041         end
0042         if positionindex == 1,
0043             set(s.(sname).(fname).handle,'HorizontalAlignment','left');
0044         end
0045     end
0046     %
0047 end
0048 
0049 
0050

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.