home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Examples / IBMole / exp.m next >
Encoding:
Text File  |  1995-04-12  |  2.3 KB  |  105 lines

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