home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 3.ddi / DEMOS.DI$ / CHOICEX.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  901 b   |  37 lines

  1. function choicex(name)
  2. %CHOICEX Close a list of choices.
  3. %    CHOICEX('NAME') closes the choice window with name 'NAME' and
  4. %    removes this name from the registration list.
  5. %    CHOICEX is used as the callback for the Close button in a choice list
  6. %    created using CHOICES.
  7. %
  8. %    See also CHOICES.
  9.  
  10. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  11.  
  12. if ~isstr(name)
  13.     error('Requires string input argument.')
  14. end
  15. name = deblank(name);
  16. % set up link to global choice names and handles and add or delete
  17. % these in lock-step
  18. global CHOICELIST
  19. global CHOICEHANDLES
  20. match = 0;
  21. for i = 1:size(CHOICELIST,1)
  22.     if strcmp(name,deblank(CHOICELIST(i,:)))
  23.         match = i;
  24.         break;
  25.     end
  26. end
  27. if match == 0   % no match
  28.     return
  29. else
  30.     delete(CHOICEHANDLES(match));
  31.     CHOICEHANDLES(match) = [];
  32.     CHOICELIST(match,:) = [];
  33.     if (match-1) > 0
  34.         set(CHOICEHANDLES(match-1),'visible','on')
  35.     end
  36. end
  37.