From: Brian G. <bri...@ea...> - 2005-06-06 01:02:32
|
Thanks for the pointer! I've never been able to get xcode to work for me, building Tcl/Tk, so I just use the makefiles. "Any sufficiently advanced technology is indistinguishable from magic" --Arthur C. Clarke -Brian On Jun 4, 2005, at 3:16 PM, Jim Ingham wrote: > If you find an instance of Str255 (or just put one temporarily in your > code) and then command-double-click on it in Xcode, it will take you > to the def'n in MacTypes.h (in the CarbonCore framework). That also > has a discussion of pascal strings, since the def'n of Str255 by > itself doesn't help too much: > > typedef unsigned char Str255[256]; > > But the discussion above this will tell you what you need. The whole > Command-double-click is very useful, 'cause there's still a lot of > stuff that is documented in the header files in useful ways. > > Jim > On Jun 4, 2005, at 1:15 PM, Brian Griffin wrote: > >> Ah! Well, I could not find any definition of Str255 in the docs I >> have. That would have helped. >> >> Thanks! >> -Brian >> >> On Jun 4, 2005, at 1:11 PM, Jim Ingham wrote: >> >> >>> menuItemName is a Str255: >>> >>> struct NavMenuItemSpec { >>> UInt16 version; >>> OSType menuCreator; >>> OSType menuType; >>> Str255 menuItemName; >>> char reserved[245]; >>> }; >>> >>> Str255 is a typedef for a 255 character Pascal string. Pascal >>> strings have the first byte as the length, and the rest is the >>> string. They aren't guaranteed to be null-terminated, so you >>> actually want to do: >>> >>> int len = strlen(filterPtr->name); >>> strncpy(&selectItem.menuItemName[1], filterPtr->name, len); >>> selectItem.menuItemName[0] = len; >>> >>> if you want to copy a C string to a Pascal string. You might want >>> to make sure len < 255 as well. >>> >>> Jim >>> >>> On Jun 4, 2005, at 11:29 AM, Brian Griffin wrote: >>> >>> >>>> After much trial and error, I determined that this makes it work: >>>> >>>> strncpy(&selectItem.menuItemName[1], filterPtr->name, >>>> strlen(filterPtr->name)); >>>> >>>> Why the menuItemName begins at location [1] is a mystery to me and >>>> is not mentioned anywhere that I've read. >>>> >>>> -Brian >>>> >>>> >>>> On Jun 2, 2005, at 8:41 PM, Brian Griffin wrote: >>>> >>>> >>>> >>>>> Hi folks, >>>>> >>>>> I've been banging on this for several hours now and am completely >>>>> stumped. I'm trying to pre-set the filter in the GetFileDialog, >>>>> but it just doesn't work. I'm calling NavCustomControl(dialogRef, >>>>> kNavCtlSelectCustomType, &menuItem); As far as I can tell from >>>>> everything I've read, this the call that supposed to do it, but >>>>> nothing happens; it continues to select the first entry. A google >>>>> search turns up others running into the same problem, but I >>>>> haven't found any answers to the problem. So what gives? Am I >>>>> using the wrong approach? Is there some magic spell or wave of the >>>>> wand that I'm missing? >>>>> >>>>> By the way, the other half of the TIP, returning the last selected >>>>> filter works just fine. I thought that would be the hard part. >>>>> :-) >>>>> >>>>> Thanks, >>>>> -Brian >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> ------------------------------------------------------- >>>> This SF.Net email is sponsored by: NEC IT Guy Games. How far can >>>> you shotput >>>> a projector? How fast can you ride your desk chair down the office >>>> luge track? >>>> If you want to score the big prize, get to know the little guy. >>>> Play to win an NEC 61" plasma display: >>>> http://www.necitguy.com/?r=20 >>>> _______________________________________________ >>>> Tcl-mac mailing list >>>> Tc...@li... >>>> https://lists.sourceforge.net/lists/listinfo/tcl-mac >>>> >>>> >>> >>> >>> >> >> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. How far can you > shotput > a projector? How fast can you ride your desk chair down the office > luge track? > If you want to score the big prize, get to know the little guy. Play > to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 > _______________________________________________ > Tcl-mac mailing list > Tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 _______________________________________________ Tcl-mac mailing list Tc...@li... https://lists.sourceforge.net/lists/listinfo/tcl-mac ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 _______________________________________________ Tcl-mac mailing list Tc...@li... https://lists.sourceforge.net/lists/listinfo/tcl-mac ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 _______________________________________________ Tcl-mac mailing list Tc...@li... https://lists.sourceforge.net/lists/listinfo/tcl-mac ------------------------------------------------------- This SF.Net email is sponsored by: NEC IT Guy Games. How far can you shotput a projector? How fast can you ride your desk chair down the office luge track? If you want to score the big prize, get to know the little guy. Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20 _______________________________________________ Tcl-mac mailing list Tc...@li... https://lists.sourceforge.net/lists/listinfo/tcl-mac |