{
Update tag with new value and with range checking.
}
procedure UpdateTag(tag:Integer; newValue:String; min,max:Real);
var rValue:Real;
begin
 rValue:=0;
 case TypeTag(tag) of
  0:;
  1:begin
     rValue:=rVal(newValue);
     if rValue<min then rValue:=_Nan;
     if rValue>max then rValue:=_Nan;
     if not IsNan(rValue) then b:=iSetTag(tag,Round(rValue));
    end;
  2:begin
     rValue:=rVal(newValue);
     if rValue<min then rValue:=_Nan;
     if rValue>max then rValue:=_Nan;
     if not IsNan(rValue) then b:=rSetTag(tag,rValue);
    end;
  3:b:=sSetTag(tag,newValue);
 end;
end;
