Mercurial > hg > ishara
view arrows/sched_ui.m @ 6:0ce3c2070089
Removed duplicate code and fixed doc in timed_action.
author | samer |
---|---|
date | Mon, 14 Jan 2013 14:33:37 +0000 |
parents | 672052bd81f8 |
children |
line wrap: on
line source
% sched_ui - Create buttons to control scheduler. function handles=sched_ui(sched,fig) clf(fig); handles=map(@(fn)mkbutton(getfield(sched,fn),fn),{'start','stop'}); layout([10,10],handles); handles=cell2mat(handles); function b=mkbutton(action,text) b=uicontrol('Parent',fig,'Style','Pushbutton','String',text,'Callback',@(a,b)action()); end end function layout(pos,handles), foldl(@add_control,pos,handles); end function cur=add_control(cur,h) pos=get(h,'Position'); set(h,'Position',[cur,pos(3:4)]); cur = cur+[0,pos(2)]; end