Annotation of Examples/EnterpriseObjects/SHLExamples/AccessLayer/ScrollViewExtensions.m, revision 1.1.1.1

1.1       root        1: 
                      2: /* ScrollViewExtensions.m:
                      3:  * You may freely copy, distribute, and reuse the code in this example.
                      4:  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
                      5:  * fitness for any particular use.
                      6:  *
                      7:  * A generic scrollview driver object to display/print text 
                      8:  * Written by Jack Greenfield
                      9:  *
                     10:  */
                     11: 
                     12: #import        <objc/objc-runtime.h>
                     13: #import "ScrollViewExtensions.h"
                     14: 
                     15: @implementation ScrollView(ScrollViewExtensions)
                     16: 
                     17: - sprintf:(const char *)format, ...
                     18: {
                     19:        id text;
                     20:        int length;
                     21:     static char buffer[65536];
                     22:     va_list arguments;
                     23: 
                     24:        va_start(arguments, format);
                     25:        vsprintf(buffer, format, arguments);
                     26:        va_end(arguments);
                     27:     
                     28:        text = [self docView];
                     29:        length = [text textLength];
                     30:        [text setSel:length :length];
                     31:        [text replaceSel:buffer];
                     32:        [text scrollSelToVisible];
                     33:     return self;
                     34: }
                     35: 
                     36: - vsprintf:(const char *)format arguments:(va_list)arguments
                     37: {
                     38:        id text;
                     39:        int length;
                     40:     static char buffer[65536];
                     41: 
                     42:        vsprintf(buffer, format, arguments);
                     43:        text = [self docView];
                     44:        length = [text textLength];
                     45:        [text setSel:length :length];
                     46:        [text replaceSel:buffer];
                     47:        [text scrollSelToVisible];
                     48:     return self;
                     49: }
                     50: 
                     51: - clear:sender
                     52: {
                     53:        id text;
                     54:     int length;
                     55: 
                     56:        text = [self docView];
                     57:        length = [text textLength];
                     58:        [text setSel:0 :length];
                     59:        [text replaceSel:""];
                     60:        [text scrollSelToVisible];
                     61:     return self;
                     62: }
                     63: 
                     64: - print:sender
                     65: {
                     66:        [[self docView] printPSCode:sender];
                     67:     return self;
                     68: }
                     69: 
                     70: - printFrom:sender
                     71: {
                     72:     return [self sprintf:"%s\n", [sender stringValue]];
                     73: }
                     74: 
                     75: @end

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.