Path: utzoo!censor!geac!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think!snorkelwacker!mit-eddie!uw-beaver!zephyr.ens.tek.com!tektronix!reed!lclark!dan From: dan@lclark.UUCP (Dan Revel) Newsgroups: comp.sys.mac.programmer Subject: Re: List Manager Strangeness Message-ID: <894@lclark.UUCP> Date: 1 Mar 90 18:56:31 GMT References: <20392@bellcore.bellcore.com> Reply-To: dan@lclark.UUCP (Dan Revel) Organization: Lewis & Clark College, Portland OR Lines: 65 In article <20392@bellcore.bellcore.com> sdh@flash.UUCP (Stephen D Hawley) writes: > * if (!LSearch((Ptr)(fName+1), (int)(*((unsigned char*)fName)), > * NIL, &c, fontList)) c.v = 0; ^^^^^^^ > if (i >= (**fontList).dataBounds.bottom) c.v = 0; /* no match */ ^^^^^^^ Watch out! c = {0,0} is a valid cell for the List Manager. >So what gives? I don't know, this works for me (Mac IIx, 5Megs, Multifinder, Think C 4.0): ListHandle fList; main() { WindowPtr fWind; Cell cSize = {15, 100}; Rect bounds = {40, 40, 400, 140}; Rect rView = {0, 0, 360, 100}; Rect dBounds = {0, 0, 0, 1}; /* no rows, one column */ fWind = NewWindow(0L,&bounds,"\pFonts",TRUE,plainDBox,-1L,FALSE,0L); fList = LNew(&rView,&dBounds,cSize,0,fWind,TRUE,FALSE,FALSE,FALSE); BuildFontList(); FindCurrentFont(fWind); while (!Button()) ; } FindCurrentFont(w) WindowPtr w; { Cell c; Str255 fName; int fNum; fNum = (*w).txFont; GetFontName(fNum, fName); c.h = c.v = 0; if (LSearch(&fName[1],fName[0],0L,&c,fList)) LSetSelect(TRUE,c,fList); } #define UnusedMenuID 150 BuildFontList() { MenuHandle tempMenu; int fontCount; Str255 aFontName; Cell c = {0, 0}; tempMenu = NewMenu(UnusedMenuID,'x'); AddResMenu(tempMenu,'FONT'); fontCount = CountMItems(tempMenu); c.v = LAddRow(fontCount, (**fList).dataBounds.bottom, fList); for (c.v = 0; c.v < fontCount; c.v++) { GetItem(tempMenu, (c.v + 1), aFontName); LSetCell(&aFontName[1], aFontName[0], c, fList); } DisposeMenu(tempMenu); } -- dan@lclark tektronix!reed!lclark!dan Dylsexics untie! (-|