Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!husc6!unix!mxmora From: mxmora@unix.SRI.COM (Matt Mora) Newsgroups: comp.sys.mac.programmer Subject: Re: Add1ResMenu routine needed Message-ID: <14104@unix.SRI.COM> Date: 13 Jul 90 00:05:32 GMT References: <36918@shemp.CS.UCLA.EDU> Reply-To: mxmora@unix.UUCP (Matt Mora) Organization: SRI International, Menlo Park, CA Lines: 38 In article <36918@shemp.CS.UCLA.EDU> tj@cs.ucla.edu (Tom Johnson) writes: >Does anyone know how I can force AddResMenu to add resources only from the >current res file? The standard call add resources from all open files-- >I want to be able to limit it to just those in my INIT (I don't want every >font there is added to my menu, just the ones in my INIT file). I guess >I'm just being lazy--I don't want to re-invent the wheel; > >Thanks- >-- >Tom Johnson UCLA Computer Science Department I had to write my own addresmenu because Addresmenu sorts the resource names. Its trivial to implement. Below is some code in pascal. FieldMenu := GetMenu(FieldMenuID) gNumFields := CountResources('FLDS'); for i := 1 to gNumFields do begin tempH := Get1Resource('FLDS', i); GetResInfo(tempH, id, rType, name); fieldsSTR[i] := name; AppendMenu(FieldMenu, name); DetachResource(tempH); FieldStr[i] := tempH; end; You just need the code up to the Appendmenu part. I needed to used the handles later in my program. This of course is an unsorted list. -- ___________________________________________________________ Matthew Mora | my Mac Matt_Mora@sri.com SRI International | my unix mxmora@unix.sri.com ___________________________________________________________