function moveline(action)

global Ulevel prescription handle 

switch action
   
case 'start'
   set(gcbf,'WindowButtonMotionFcn','moveline move');
   set(gcbf,'WindowButtonUpFcn','moveline stop');
   moveline move;
   
case 'move'
   currentPoint = get(gca,'CurrentPoint');
   newY = currentPoint(3);
   newY = min(100,max(0,newY));
   LocalSetDisplay(newY)
   
case 'stop'
   set(gcf,'WindowButtonMotionFcn','');
   set(gcf,'WindowButtonUpFcn','');
   
case 'enter'
   newY = eval(get(gcbo,'String'));
   newY = min(100,max(0,newY));
   LocalSetDisplay(newY);
   
end

function LocalSetDisplay(newY)

global prescription handle

pointerHandle = findobj(gcbf,'Tag','redline');
newY = round(newY);
set(pointerHandle,'YData',[0 newY]);
newYHndl = findobj(gcbf,'Tag','PrescriptionText');
set(newYHndl,'String',sprintf('%3.0f',newY))
