TFT LCD TFTscreen.text WRAP next line etc

hello, I cannot seem to find the solution.

when we write TEXT to the lcd even using the TFTscreen.setTextWrap(true); (which only seems to work with some library’s)

the text will either load off screen or WRAP but not at the spaces and break words up.

any idea how to overcome this issue? and format text with more control. like CENTER text etc.

if there a way to see more DETAILED commands of library?

thanks again,

best ref I can find

https://www.arduino.cc/en/Reference/TFTLibrary
and

I am new to arduino and the examples help, but there is limited detailed info.

running a uno with a 1.8 SPI TFT 128x160

THANKS

running a uno with a 1.8 SPI TFT 128x160

We usually talk about the TFT with the physical size, protocol, resolution, and controller:
1.8" SPI TFT 128x160 with ST7735R

If you are using the Adafruit library, you can only utilize the function that Adafruit has written. Another library may have similar functions, extra functions, and may not include some of the Adafruit functions. Trust us all, it is a big mess. Once you get used to a TFT library, it is a real pain to switch.

Why switch? Sometimes it is because we need a function(s) just not available, or maybe we need a library that supports some weird display controller, or maybe the Adafruit library takes too many resources and we go looking for a smaller library.

Adafruit uses 2 libraries for their displays, one a "driver" library that matches the controller chip on the display and a second library that implement the user interface: that is, functions available. In the case of the ST7735, the driver library is here.

The PDF user documentation for the graphic support functions is here.

Ray

thanks, I already shared that info in my post

what I am looking for now is a general way to wrap words or format them with code

ie. define a max width and to goto the next line if the word is longer and split only at a space.

thanks

g43q654wutrjh:
thanks, I already shared that info in my post

what I am looking for now is a general way to wrap words or format them with code

ie. define a max width and to goto the next line if the word is longer and split only at a space.

thanks

You do realize that what you are discussing is a rudimentary word-processor; because there must be look-ahead capability to extract words from the character stream.

You can do this by buffering a line (until the NL or CR) and then spooling the buffer to the display… a word at a time, ensuring that each word can fit on the current line and if not, moving to the new line, eating spaces until the first non-space character, printing the word, and adjusting the line character pointer.

Lot of math.

I have done this a zillion time in other languages, but on a microcontroller it seems a bit silly (to me.) Anyway, much of the structure can be seen in one of my projects, here. Remember, this code will get you maybe 50% of the way there. You will need to implement a "word-centric’ approach.

Ray

PS: Added code snippet from project to show what happens when the end-of-line of the input stream is encountered…

      if( c == 13 )            // carriage return?
      {
        c = 0 ;
        lcd.print( sBlank ) ;         // clear line from current position, may wrap
        nRow = (nLCD / 26) + 1 ;      // next row (row == 0, 1, ... 14)
        if( nRow > 15 ) nRow = 0 ;    // maintain boundary
        index = nRow ;                // array index for graphic "Y" position of first character
        nCol = 0 ;                    // "X" Graphic coordinate
        nRow = yCord[ index ]  ;      // Graphic "Y" coordinate via lookup
        nLCD = index * 26  ;          // 26 characters per line (line = nRow +1)
        lcd.setCursor (nCol, nRow) ;  // restore cursor to home character of current line
        //lcd.print( sBlank ) ;         // clear NEW line
        lcd.setCursor (nCol, nRow) ;  // restore cursor to home character of current line
        if(lDebug)
        {
          Serial1 << "Return Pressed!  " << "nCol / nRow / nLCD == " ;
          Serial1 << nCol << " / " << nRow << " / " << nLCD << "\n \r" ;
        }
      }

wow that's bit more then I understand.