function theResult = PXEvent(self, thePXEvent, theMessage)

% PXEvent -- Process an event.
%  PXEvent(self, thePXEvent, theMessage) processes thePXEvent
%   and theMessage that have been sent to self, a "px" object.
%   Menu selections and non-scrollbar callbacks cause thePXEvent
%   to be displayed with no further action.
 
% 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 08-Apr-1997 10:37:15.

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

if nargin < 2, thePXEvent = ''; end
if nargin < 3, theMessage = []; end

result = [];

switch lower(thePXEvent)
case 'buttondownfcn'
case 'callback'
   switch lower(get(gcbo, 'Tag'))
   case {'xscroll', 'yscroll', 'zscroll', 'cscroll'}
      pxscroll(gcbo)
   otherwise
      disp(thePXEvent)
   end
case 'closerequestfcn'
case 'resizefcn'
   pxresize(self)
case 'windowbuttondownfcn'
   if strcmp(get(px(self), 'SelectionType'), 'open')
      thePXEvent = 'DoubleClickFcn';
      pxhome
   end
   pxenable(px(self), 'WindowButtonMotionFcn')
case 'windowbuttonmotionfcn'
case 'windowbuttonupfcn'
   set(px(self), 'WindowButtonMotionFcn', '')
otherwise
   disp(thePXEvent)
end

if nargout > 0
   theResult = result;
end
