function makevalbox(varname,init,posn)

width = 50; height = 24;

uicontrol('Style','text','Position',[posn+[2 height], width-4,  height-4], ...
    'String',varname);

h=uicontrol('Style','edit','Position',[posn width height], ...
    'String',num2str(init),'UserData',varname, ...
    'BackGroundColor',[1 0.8 0.4], 'FontWeight','bold',...
    'CallBack','updatevalbox(gcbo)');

updatevalbox(h)
