domenikos@emass1.enet.dec.com (George Domenikos) (03/27/91)
Hi there, I have notice a limitation of the List Manager. I have created a list structure and I have noticed that the maximum number of entries I can insert in the list every single time is 32K bytes or in my case about 250 entries. I would very much like to be able to hold more than 250 entries in a single list. Does any know of a painless way to increase the internal storage of a list structure. Do I have to deal with custom list definitions to achieve that? thanks george
peirce@outpost.UUCP (Michael Peirce) (03/27/91)
In article <4214@ryn.mro4.dec.com>, domenikos@emass1.enet.dec.com (George Domenikos) writes: > > > Hi there, > I have notice a limitation of the List Manager. I have created a list > structure and I have noticed that the maximum number of entries I can > insert in the list every single time is 32K bytes or in my case about 250 > entries. I would very much like to be able to hold more than 250 entries in > a single list. > Does any know of a painless way to increase the internal storage of a > list structure. > Do I have to deal with custom list definitions to achieve that? Well, if you are willing to create a custom list definition you can store handles in the list and then store your data in the handle - making your custom LDEF access whatever it needs in the handle. If you want to store LOTS of data, you might just have one handle, and store offsets into the handle (so as not to have zillions of handles floating around). -- michael -- Michael Peirce -- outpost!peirce@claris.com -- Peirce Software -- Suite 301, 719 Hibiscus Place -- Macintosh Programming -- San Jose, California 95117 -- & Consulting -- (408) 244-6554, AppleLink: PEIRCE
omh@cs.brown.edu (Owen M. Hartnett) (03/28/91)
In article <4214@ryn.mro4.dec.com> domenikos@emass1.enet.dec.com (George Domenikos) writes: > >Hi there, >I have notice a limitation of the List Manager. I have created a list >structure and I have noticed that the maximum number of entries I can >insert in the list every single time is 32K bytes or in my case about 250 >entries. I would very much like to be able to hold more than 250 entries in >a single list. >Does any know of a painless way to increase the internal storage of a >list structure. >Do I have to deal with custom list definitions to achieve that? Yes, Virginia, you can abuse the list manager. :-) But you do have to write your own LDEF. It's not hard - probably the easiest thing to program on the Macintosh. If you use Larry Rosenstein's neat little hack about including it in your own code (more later) it becomes easy to debug also. How to abuse the List Manager: Don't store your data in the list manager. You already know what your data is, store it somewhere else - just have a way of getting to it fast (i.e. keep it in RAM, at worst on a disk drive - but try to maximize for speed, you don't want to keep your users waiting.) In your LDEF, in the Draw Segment, draw your data. That's all there is to it. For the highlight segment, invert your cell. Do everything else the same way (number of cells, etc.), just don't put any data into that TERec masquerading as a database (the List manager's data storage). When your LDEF gets called to draw, it will get 1) the rectangle it's supposed to draw in and 2) the cell it's supposed to draw. So look up the correct data for the cell from your application and MoveTo a spot in the rectangle where you won't cut the legs off your letters and DrawString. I have done this with up to 24,000 cells in a program with very little performance loss. (your scroll bar kind of has a renewed sense of power, though) Back to Larry's hack: Write your LDEF as part of your code. In your application, call NewHandle(6) [that's a NewHandle of size 6 bytes]. In the first two bytes write a JSR instruction, in the last 4 bytes, write the address of your LDEF. Then install the Handle in the ListRecord where the LDEF goes. Now you can debug it with your source level debugging tools. -Owen Owen Hartnett omh@cs.brown.edu.CSNET Brown University Computer Science omh@cs.brown.edu uunet!brunix!omh "Don't wait up for me tonight because I won't be home for a month."
rmh@apple.com (Rick Holzgrafe) (03/28/91)
In article <0B010004.03dfjc@outpost.UUCP> peirce@outpost.UUCP (Michael Peirce) writes: > > Does any know of a painless way to increase the internal storage of a > > list structure. > > Do I have to deal with custom list definitions to achieve that? > > Well, if you are willing to create a custom list definition you can > store handles in the list and then store your data in the handle - > making your custom LDEF access whatever it needs in the handle. Right. And to add my $0.02 worth, writing custom LDEFs is very simple. All one really needs to do is draw the given data in the given rectangle, and invert (or otherwise highlight) it on request. Try it, it's fun! ========================================================================== Rick Holzgrafe | {sun,voder,nsc,mtxinu,dual}!apple!rmh Software Engineer | AppleLink HOLZGRAFE1 rmh@apple.com Apple Computer, Inc. | "All opinions expressed are mine, and do 20525 Mariani Ave. MS: 3-PK | not necessarily represent those of my Cupertino, CA 95014 | employer, Apple Computer Inc."