function theResult = PXValue(self, theValue)

% PXValue -- Set/get the value.
%  PXValue(self, theValue) sets the value of self,
%   a "pxpatch".  Use a value of 0 or [] to de-select
%   the patch, and 1 to select it.
%  PXValue(self) returns 1 for if the patch associated
%   with self is selected; otherwise, 0.
 
% 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

h = px(self);

if nargin > 1
   set(h, 'SelectionHighlight', 'on')
   if isempty(theValue), theValue = 0; end
   selected = any(theValue);
   switch theValue
   case 0
      set(h, 'Selected', 'off')
   otherwise
      set(h, 'Selected', 'on')
   end
end

selected = get(h, 'Selected');
switch lower(selected)
case 'off'
   selected = 0;
case 'on'
   selected = 1;
end

if nargout > 0, theResult = selected; end
