home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / next / programm / 5391 < prev    next >
Encoding:
Text File  |  1992-07-31  |  1.7 KB  |  52 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!nic.unh.edu!strangeways.unh.edu!tjb
  3. From: tjb@strangeways.unh.edu (Thomas J. Baker)
  4. Subject: Indentifying menu Items from a target object
  5. Message-ID: <1992Jul31.170612.5317@strangeways.unh.edu>
  6. Sender: tjb@strangeways.unh.edu (Thomas J. Baker)
  7. Reply-To: tjb@strangeways.unh.edu (Thomas J. Baker)
  8. Organization: Baker Consulting  -  Dover, NH
  9. Date: Fri, 31 Jul 1992 17:06:12 GMT
  10. Lines: 40
  11.  
  12.  
  13. I'm building a submenu on the fly that will contain the names of the  
  14. current uucp-connected systems:  Here is the code:
  15.  
  16.  
  17. systemMenu = [[Menu alloc] init];    
  18. subCell = [mainMenu findCellWithTag:28];
  19. [mainMenu setSubmenu:systemMenu forItem:subCell];
  20.     
  21. pp = popen("/usr/bin/uuname","r");
  22.     
  23. while(fgets(instr,sizeof(instr),pp) != NULL) {
  24.     instr[strlen(instr) - 1] = '\0';
  25.     strcat(instr,"...");
  26.     newCell = [systemMenu addItem:instr action:@selector(newMonitor:)
  27.         keyEquivalent:0];
  28.     [newCell setTarget:self];
  29. }
  30.     
  31. pclose(pp);
  32.  
  33.  
  34.  
  35. The newMonitor is defined as - newMonitor:sender.  The menu builds  
  36. beautifully but when testing and choosing one of my new menu items,  
  37. instead of getting the id of the menuCell in newMonitor, I get the id of  
  38. the Matrix of menuCells.  
  39.  
  40. How can I set this up so that I can identify which cell sent the message?   
  41. Is this the best way to approach the problem?
  42.  
  43. Thanks,
  44.  
  45. tjb
  46. --
  47. +-------------------------------------------------------------------+
  48. | Thomas Baker        Director of the New Hampshire NeXT User Group | 
  49. | P.O. Box 213           Internet/NeXTmail: tjb@strangeways.unh.edu |
  50. | Durham, NH 03824                   Voice: (603) 743-4987          |
  51. +-------------------------------------------------------------------+
  52.