home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / nrdargs / CreateTTArray.doc < prev    next >
Encoding:
Text File  |  1999-09-06  |  1.8 KB  |  59 lines

  1.                    CreateTTArray.c
  2.              © 1998 by Stephan Rupprecht
  3.                        All rights reserved.
  4.     
  5.  
  6. COPYRIGHT AND DISCLAIMER
  7.    CreateTTArray copyrighted 1998 by Stephan Rupprecht. All rights 
  8.    reserved. This program is freeware, so no financial donations 
  9.    required. Redistribution allowed if the package is left unchanged.   
  10.    The author is not responsible for any damage caused by the use or 
  11.    misuse of this documentation and/or the program(s) it describes.
  12.  
  13.  
  14. FUNCTION
  15.    CreateTTArray is a simple function that creates a tooltype array from
  16.    ReadArgs() template string and an intialized LONGWORD array (eg. previously
  17.    passed to [New]ReadArgs). This function is meant for programs that save their
  18.    preferences (like PrintManager v39 by me:) in their icon.
  19.  
  20.    char **CreateTTArray( STRPTR template, LONG *array, APTR *poolp, char **orig )
  21.  
  22.    template: valid ReadArgs() template string
  23.    array:    ReadArgs longword array (must be correctly intialized)
  24.    poolp:    Pointer to an APTR that will (in case of success) hold the address
  25.          of a memory pool that were created by the exec.lib function CreatePool
  26.    orig:     optional pointer to the old tooltype array (currently only used to 
  27.          decide if STARTPRI and TOOLPRI should be included into the new array).
  28.  
  29. EXAMPLE
  30.  
  31.    ...
  32.  
  33.    rd = ReadArgs( TEMPLATE, array, NULL );
  34.  
  35.    ...
  36.  
  37.    if( dobj = GetDiskObject( MYICON ) )
  38.    {
  39.     oldtta = dobj->do_ToolTypes;
  40.     
  41.     if( tta = CreateTTArray( TEMPLATE, array, &pool, oldtta ) )
  42.     {
  43.       dobj->do_ToolTypes = tta;
  44.       PutDiskObject( dobj );
  45.       dobj->do_ToolTypes = oldtta;
  46.       DeletePool( pool );
  47.     }
  48.     FreeDiskObject( dobj );
  49.    }
  50.  
  51.    ...
  52.  
  53.    FreeArgs( rd );
  54.  
  55.    ...
  56.  
  57. NOTE
  58.    You can always find the DONOTWAIT tooltype in the array created by CreateTTArray.
  59.