function tsNameChanged(h,eventsrc,eventdata)
%

%   Author(s): James G. Owen, Rong Chen
%   Copyright 1986-2003 The MathWorks, Inc. 
%   $Revision: 1.1.6.1 $  $Date: 2004/12/26 21:36:02 $

if strcmp(eventsrc.Name,'Name')
    % name changed
    tmp=get(h,eventdata.AffectedObject.name);
    delete(findprop(h,eventdata.AffectedObject.name));
    p = schema.prop(h,eventdata.NewValue,'handle');
    set(h,eventdata.NewValue,tmp);
    try
        delete(h.Listeners_.(eventdata.AffectedObject.name));
    catch
    end
    h.Listeners_.(eventdata.NewValue) = handle.listener(eventdata.AffectedObject, ...
        findprop(eventdata.AffectedObject,'Name'), 'PropertyPreSet', ...
        @(es,ed) tsNameChanged(h,es,ed));
end

