Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!purdue!haven!umd5!zben From: zben@umd5.umd.edu (Ben Cranston) Newsgroups: comp.sys.mac.programmer Subject: Re: Leading dashes in menu items. Summary: Put a null as the first byte of the string Message-ID: <6657@umd5.umd.edu> Date: 11 Jun 90 19:30:52 GMT References: <573@argosy.UUCP> Reply-To: zben@umd5.umd.edu (Ben Cranston) Distribution: na Organization: University of Maryland, College Park Lines: 31 In article <573@argosy.UUCP> freeman@cleo.UUCP (Jay R. Freeman) writes: > I need to create a menu item whose entire text consists merely of a > single minus sign. Of course I can't just do that, because a single > minus sign is menu-manager meta-syntax for drawing a dashed line > across the menu. And it appears that a leading minus sign is NOT one > of the meta-characters whose effect you can get around by using > SetItem (I think it is) on the actual text. The trick I have always used in this case is to make the first character of the menu item text a null (character code zero). This is not displayed but is enough to thwart the comparison in the menu manager. The combination of this and always using SetItem or whatever seems to work for me: string[0] = 2; string[1] = 0; string[2] = '-'; SetItem(blatmenu,BMDASH,string); Coding from memory without my trusty IM-I so don't flame if I goofed. Cannot remember where the null trick came from, might be IM, tech note, the network, MacTutor, who knows... Lest we belabor the obvious, make sure this doesn't faze any of your code that might do a GetItem and look at the string, for you'll surely see the null come right back to you! -- "It's all about Power, it's all about Control All the rest is lies for the credulous" -- Man-in-the-street interview in Romania one week after Ceaucescu execution.