home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / Palettes / IBMole / Examples / exp.m next >
Encoding:
Text File  |  1994-06-11  |  2.2 KB  |  103 lines

  1. #import <remote/NXConnection.h>
  2.  
  3. main()
  4. {
  5.     id server;
  6.     id docList;
  7.     int count;
  8.     id 
  9.         obj,
  10.         cell,
  11.         parser;
  12.     char
  13.         *t;
  14.     
  15.     server = [NXConnection connectToName:"IBMole"];
  16.     if (server)
  17.     {
  18.         printf("Got the mole!\n");
  19.     }
  20.     docList = [server docList];
  21.     count = [docList count];
  22.     printf("%d docs\n",count);
  23.     while (count--)
  24.     {
  25.         int objCount;
  26.         id objs=[[List alloc] init];
  27.         
  28.         [[docList objectAt:count] getObjects:objs];
  29.         objCount = [objs count];
  30.     printf("%d objects\n",objCount);
  31.         while (objCount--)
  32.         {
  33.             cell = nil;
  34.             obj = [objs objectAt:objCount];
  35.             
  36.             if ([obj respondsTo:@selector(stringValue)] &&
  37.                 [obj respondsTo:@selector(setStringValue:)])
  38.             {
  39.             printf(".");
  40.                 t = [obj stringValue];
  41.                 if (t && (!strcmp("Cost per Share",t)))
  42.                 {
  43.                     [obj setStringValue:"Cost per Unit"];
  44.                     [[docList objectAt:count] redrawObject:obj];
  45.                     [[docList objectAt:count] touch];
  46.                     printf("Changed one!\n");
  47.                 }
  48.             }
  49.  
  50.             if ([obj respondsTo:@selector(title)] &&
  51.                 [obj respondsTo:@selector(setTitle:)])
  52.             {
  53.             printf(".");
  54.                 t = [obj title];
  55.                 if (t && (!strcmp("Entity",t)))
  56.                 {
  57.                     [obj setTitle:"Account"];
  58.                     [[docList objectAt:count] redrawObject:obj];
  59.                     [[docList objectAt:count] touch];
  60.                     printf("Changed one!\n");
  61.                 }
  62.                 else if (t && (!strcmp("Account",t)))
  63.                 {
  64.                     [obj setTitle:"Subaccount"];
  65.                     [[docList objectAt:count] redrawObject:obj];
  66.                     [[docList objectAt:count] touch];
  67.                     printf("Changed one!\n");
  68.                 }
  69.                 else if (t && (!strcmp("Ledger Acct",t)))
  70.                 {
  71.                     [obj setTitle:"Ledger Name"];
  72.                     [[docList objectAt:count] redrawObject:obj];
  73.                     [[docList objectAt:count] touch];
  74.                     printf("Changed one!\n");
  75.                 }
  76.                 else if (t && (!strcmp("Ledger Account",t)))
  77.                 {
  78.                     [obj setTitle:"Ledger Name"];
  79.                     [[docList objectAt:count] redrawObject:obj];
  80.                     [[docList objectAt:count] touch];
  81.                     printf("Changed one!\n");
  82.                 }
  83.             }
  84.  
  85.             if ([obj respondsTo:@selector(keyEquivalent)] &&
  86.                 [obj respondsTo:@selector(setKeyEquivalent:)])
  87.             {
  88.             printf(".");
  89.                 if ([obj keyEquivalent] == 'R')
  90.                 {
  91.                     [obj setKeyEquivalent:'V'];
  92.                     [[docList objectAt:count] redrawObject:obj];
  93.                     [[docList objectAt:count] touch];
  94.                     printf("Changed R to V!\n");
  95.                 }
  96.             }
  97.  
  98.  
  99.         }
  100.     }
  101.     exit(0);
  102. }
  103.