gusucode.com > vnt工具箱matlab源码程序 > vnt/vntblks/vntmasks/private/privatecansltimesreplay.m
function success = privatecansltimesreplay(dialog, value) %PRIVATECANSLTIMESREPLAY Callback to number of times replay field. % % SUCCESS = PRIVATECANSLTIMESREPLAY(DIALOG, VALUE) is used as a % callback to validate the number of times edit field contained in % DIALOG, a dialog object and VALUE is the current changed value. % % Returns a boolean, SUCCESS, true if the replay times settings % were valid. False, otherwise. % SS 03-01-11 % Copyright 2011 The MathWorks, Inc. % Initialize success. success = true; % Get the source object from the dialog. obj = dialog.getDialogSource; % Get error strings. msgStrings = privatevntslstring('errorstrings'); % Convert message period to number. numTimes = str2num(value); %#ok<ST2NM> % Check for non-numeric and negative values. if isempty(numTimes) || ~isscalar(numTimes) || ~isnumeric(numTimes) || ... isnan(numTimes) || ~isreal(numTimes) || floor(numTimes)~=numTimes || numTimes<=0 % Allow Inf. success = false; end % Call error if present. if ~success % Call T&M function to display error dialog. tamslgate('privatesldialogbox', dialog, ... msgStrings.NumTimesInvalid, ... msgStrings.ErrorDialogTitle ); % Restore the previous value on the dialog. obj.Block.NoTimesReplay = obj.NoTimesReplay; return; end % Assign the replay times from the block to the source. obj.Block.NoTimesReplay = value; obj.NoTimesReplay = obj.Block.NoTimesReplay; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%