home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / cdrom / compactplayer / source / listbrowser.c < prev    next >
C/C++ Source or Header  |  1995-12-28  |  840b  |  40 lines

  1. #define __USE_SYSBASE=1
  2. #include <proto/listbrowser.h>
  3. #include <gadgets/listbrowser.h>
  4. #include <proto/exec.h>
  5. #include <exec/memory.h>
  6.  
  7. struct List *
  8. EditBrowserNodesA( STRPTR *labels )
  9. {
  10.     struct TagItem ti[5];
  11.     struct List *l;
  12.     struct Node *n;
  13.     
  14.     /* allocate a simple 1 column ListBrowser list from a label array */
  15.     
  16.     if (!labels)
  17.         return NULL;
  18.         
  19.     if (!(l = AllocMem(sizeof(struct List), MEMF_PUBLIC|MEMF_CLEAR)))
  20.         return NULL;
  21.         
  22.     NewList( l );
  23.     
  24.     ti[0].ti_Tag = LBNCA_Text;
  25.     ti[1].ti_Tag = LBNCA_CopyText; ti[1].ti_Data = TRUE;
  26.     ti[2].ti_Tag = LBNCA_MaxChars; ti[1].ti_Data = 39;
  27.     ti[3].ti_Tag = LBNCA_Editable; ti[3].ti_Data = TRUE;
  28.     ti[4].ti_Tag = TAG_END;
  29.     
  30.     while (*labels)
  31.     {
  32.         ti[0].ti_Data = (ULONG)*labels;
  33.         if (!(n = AllocListBrowserNodeA( 1, ti )))
  34.             break;
  35.         n->ln_Name = *labels++;
  36.         AddTail( l, n );
  37.     }
  38.     return l;
  39. }
  40.