function theResult = PXValue(self, theValue)

% PXValue -- Set/get the value.
%  PXValue(self, theValue) sets the value of self,
%   a "pxline", by selecting those points of self
%   indicated by the indices given in theValue.
%   Use a value of [] to de-select the whole line.
%  PXValue(self) returns the indices of the points
%   of self that are currently selected.
 
% Copyright (C) 1997 Dr. Charles R. Denham, ZYDECO.
%  All Rights Reserved.
%   Disclosure without explicit written consent from the
%    copyright owner does not constitute publication.
 
% Version of 06-Jun-1997 11:00:55.

if nargin < 1, help(mfilename), return, end

g = pxget(self, 'itsMask');
gz = get(g, 'ZData');

if nargin > 1
   if isempty(theValue)
      gz = NaN;
     else
      h = px(self);
      z = get(h, 'ZData');
      f = find(theValue >= 1 | theValue <= length(z));
      theIndices = theValue(f);
      gz(theIndices) = z(theIndices);
   end
   set(g, 'ZData', gz)
end
  
result = find(~isnan(gz));

if nargout > 0, theResult = result; end
