[comp.sys.mac.programmer] How to find # of items in DITL?

mcdonald@fornax.UUCP (Ken Mcdonald) (02/06/90)

I'm working on a program which reads in a Dialog and then massages the
elements.  How can I find the number of items in the dialog's item list?
(Under Think C)

Thanks,
Ken McDonald
{mcdonald@cs.sfu.ca}

pete@titan.rice.edu (Pete Keleher) (02/08/90)

> I'm working on a program which reads in a Dialog and then massages the
> elements.  How can I find the number of items in the dialog's item list?
> (Under Think C)

Your filterProc's first argument is a dialogPtr. If you cast this to a
"dialogPeek", you can reference a field called "items" (or something like
that). "Items" is a handle to the DITL list in memory, the first short word
of which is the number of items in the dialog minus one.

--

Pete Keleher						pete@titan.rice.edu

mithomas@bsu-cs.bsu.edu (Michael Thomas Niehaus) (02/08/90)

> I'm working on a program which reads in a Dialog and then massages the
> elements.  How can I find the number of items in the dialog's item list?
> (Under Think C)

I don't know if this is what you are looking for, but the Communications
Toolbox already includes a routine that does this (which will be included
in System 7.0, and 6.0.x if you get the CommToolbox from APDA).

Some of the nice routines included are:
   AppendDITL(theDialog,theDITL,method);
   numItems = CountDITL(theDialog);
   ShortenDITL(theDialog,numberOfItems);

Also, the AppleTalk "Standard File" utilities NuLookup and NuPLookup are
also included.

-Michael

-- 
Michael Niehaus        UUCP: <backbones>!{iuvax,pur-ee}!bsu-cs!mithomas
Apple Student Rep      ARPA:  mithomas@bsu-cs.bsu.edu
Ball State University  AppleLink: ST0374 (from UUCP: st0374@applelink.apple.com)