🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #382

Indentifying menu Items from a target object

#382
From: Thomas J. Baker
Date: Fri, 31 Jul 1992 17:06
40 lines
1754 bytes
I'm building a submenu on the fly that will contain the names of the  
current uucp-connected systems:  Here is the code:


systemMenu = [[Menu alloc] init];	
subCell = [mainMenu findCellWithTag:28];
[mainMenu setSubmenu:systemMenu forItem:subCell];
	
pp = popen("/usr/bin/uuname","r");
	
while(fgets(instr,sizeof(instr),pp) != NULL) {
	instr[strlen(instr) - 1] = '\0';
	strcat(instr,"...");
	newCell = [systemMenu addItem:instr action:@selector(newMonitor:)
		keyEquivalent:0];
	[newCell setTarget:self];
}
	
pclose(pp);



The newMonitor is defined as - newMonitor:sender.  The menu builds  
beautifully but when testing and choosing one of my new menu items,  
instead of getting the id of the menuCell in newMonitor, I get the id of  
the Matrix of menuCells.  

How can I set this up so that I can identify which cell sent the message?   
Is this the best way to approach the problem?

Thanks,

tjb
--
+-------------------------------------------------------------------+
| Thomas Baker        Director of the New Hampshire NeXT User Group | 
| P.O. Box 213           Internet/NeXTmail: tjb@strangeways.unh.edu |
| Durham, NH 03824                   Voice: (603) 743-4987          |
+-------------------------------------------------------------------+
Technical Details
Message-ID: <1992Jul31.170612.5317@strangeways.unh.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!nic.unh.edu!strangeways.unh.edu!tjb

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!nic.unh.edu!strangeways.unh.edu!tjb
From: tjb@strangeways.unh.edu (Thomas J. Baker)
Subject: Indentifying menu Items from a target object
Message-ID: <1992Jul31.170612.5317@strangeways.unh.edu>
Sender: tjb@strangeways.unh.edu (Thomas J. Baker)
Reply-To: tjb@strangeways.unh.edu (Thomas J. Baker)
Organization: Baker Consulting  -  Dover, NH
Date: Fri, 31 Jul 1992 17:06:12 GMT
Lines: 40