home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.sys.apple2      Discussion about Apple II micros      56,720 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 56,064 of 56,720   
   Tom Thumb to Kelvin Sherlock   
   Re: Output to window with TextEdit   
   22 Feb 23 07:22:53   
   
   From: justliketomsthumbsblues@gmail.com   
      
   On Tuesday, February 21, 2023 at 6:00:32 PM UTC-5, Kelvin Sherlock wrote:   
   > TESetText() replaces all the existing text. There is no TEAppendText()    
   > but you can    
   >    
   > TESetSelection((Pointer)-1, (Pointer)-1, teH);    
   > TEInsert(teDataIsTextBlock | teTextIsPtr, (Ref)buffer, length, 0, NULL,   
   teH);    
   >    
   > You probably don't need to worry about style records for now but if you    
   > call TEStyleChange()    
   > after the control is created and there's no selection, it will be the    
   > default style (and for a console log, you probably only want a single    
   > style).    
   >    
   > Side note - if the TextEdit control is read-only, TESetText and    
   > TEInsert() don't do anything.    
   > You would need to fiddle with the textFlags to make it writable before    
   > trying to modify it.   
   > On 2023-02-21 19:33:02 +0000, Tom Thumb said:    
   >    
   > > I admit freely I’m floundering around but… I’m trying to write a    
   > > desktop application for the IIgs in C to set flagstones, borrowing    
   > > heavily from Mike Westerfield’s “Toolbox Programming in C”. In the    
   > > course of that endeavor I’ve gone a bit far afield trying to output    
   > > printf statements to a desktop window that I can scroll through and    
   > > copy and paste to save or whatever, basically a console window I guess.    
   > > I’ve had some success starting up the tools with Orca’s startdesk(); ,    
   > > setting the grafport and calling printf() but I wanted to use TextEdit    
   > > and so switched to StartUpTools and have had much less success.    
   > >   
       
    will give TESetSelection and TEInsert a try but I don’t understand why   
   I’m not displaying the strings in the buffer my output window.   
   I’ve populated the buffer in initbfr by calling:   
      
   void xprintf(char *str)   
    {   
       int cnt;   
       cnt = outbfr.indx;   
      
   /*   
   outbfr is declared globally: outputbfr outbfr; and is a structure:   
      
   typedef struct outputbfr{   
      
       int indx;   
       char **outstrs;   
      
   } outputbfr;   
   */   
      
       outbfr.outstrs[outbfr.indx++] = str;   
      
       printf("%d: ",cnt);   
       /* printf(outbfr.outstrs[cnt]); */   
       printf(*((outbfr.outstrs) + cnt));  /* output to text screen */   
      
      
    }   
      
   So I thought given I have a pointer to my text buffer: tPtr = (LongWord *)   
   (&outbfr); and I’ve called: TESetText(5, (Ref) tPtr, length, 0,(Ref) NULL,   
   NULL); that whenever there is an update event since I declared the window as:   
   NewWindow2("\pOutput", 0,   
    Output, NULL, 0x02, teControl, rWindParam1); that Output() is called and so   
   DrawControls is called and I thought my text would be displayed but I just get   
   stuff like: -˛™◊»D‘˛€ and ? marks I assume are non printing   
   characters.   
      
   So why can’t I display a cstring I’ve tried pointing to by:   
      
   LongWord *tPtr;   
   tPtr = (LongWord *) ((outbfr.outstrs[0]));    
   tPtr = (LongWord *) ((LongWord)(*(outbfr.outstrs)));   
   tPtr = (LongWord *) (&outbfr);   
      
   TESetText(5, (Ref) tPtr, length, 0,(Ref) NULL, NULL);   
      
   The strings are displayed on the text screen when I quit the app by the   
   printf() calls in xprintf(). Did I mention I’m floundering around?    
      
   — Mark Wade   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca