Path: utzoo!attcan!uunet!husc6!paperboy!snorkelwacker!apple!apple.COM!han From: han@apple.COM (Byron Han, Project Scapegoat) Newsgroups: comp.sys.mac.programmer Subject: Re: Add1ResMenu routine needed Message-ID: <9180@goofy.Apple.COM> Date: 17 Jul 90 03:14:11 GMT Sender: usenet@Apple.COM Organization: Apple Computer, Inc. - N&C Lines: 39 References:<36918@shemp.CS.UCLA.EDU> <14104@unix.SRI.COM> In article <14104@unix.SRI.COM> mxmora@unix.SRI.COM (Matt Mora) writes: > 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 will probably want to bracket the calls to Get1Resource() with SetResLoad(FALSE)/SetResLoad(TRUE) to cut down on memory usage. You also should check to see if the resource returned from Get1Resource() is NIL or not. Another problem is that if the resource name contains any of the special Menu Manager metacharacters, the menu may look funny. I often use, AppendMenu(hMenu, 'X'); curItem := CountMItems(hMenu); SetItem(hMenu, curItem, theRealThing); Hope this helps! +-------------------------------------------------------------------------+ | Disclaimer: Apple has no connection with my postings. | +-------------------------------------------------------------------------+ Byron Han, CommToolbox Scapegoat "Not Working 100 hrs/wk and loving it!" Apple Computer, Inc. -------------------------------- 20525 Mariani Ave, MS 69L Internet: han@apple.COM Cupertino, CA 95014 UUCP:{sun,voder,nsc,decwrl}!apple!han -------------------------------- GENIE:BYRONHAN CompuServe:72167,1664 ATTnet: 408-974-6450 Applelink:HAN1 HAN1@applelink.apple.COM ---------------------------------------------------------------------------