From: Brian G. <bri...@ea...> - 2005-06-05 21:48:11
|
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 ------------------------------------------------------- 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 |