Announcement

Collapse
No announcement yet.

Format txt_set()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Format txt_set()

    The following code snip prints to the display in the same size and font, but ignores the text size command. txt_Set(TEXT_COLOUR,BLUE) works.
    txt_Set(4,5);
    txt_Set(5,5);
    print (" ",[DEC]f,".",[DEC]d); //does not print formatted

    If I remove the " " before the previous line, the large font will take, but only as far as printing the variable "f". Variable "g" and character "." are printed on the same line, but really small.

    Bug?

  • #2


    I was caught by the same problem. The docs for txt_Set() height and width state: The TEXT_WIDTH (TEXT_HEIGHT) change only persists for the next text or graphics printing funtion then reverts back to the default value of 1.
    I found out the hard way that using print([DEC]f,".",[DEC]d); is actually three print operations and the width and height revert to the default after the first part of the "string" is printed. You have a couple of choices. Break the statement above into multiple print statements preceeded by the width and height settings or build your string in an array and use the putstr(); command to print the contents of the array as below:

    HTML Code:
    #platform "uOLED-32028-P1" 
    #inherit "4DGL_16bitColours.fnc"
    var buffer[10]; // 20 character buffer for strings
    var f;
    var d;
    
    func main()
    f:=37;
    d:=50;
    to(buffer); print([DEC]f,".",[DEC]d); // build your string in 'buffer'
    
    txt_Set(TEXT_COLOUR,BLUE);
    txt_Set(4,4);
    txt_Set(5,4);
    putstr(buffer); // use putstr to print contents of 'buffer'
    repeat forever
    endfunc
    Steve
    Any technology, sufficiently developed, is indistinguishable from magic. A.C. Clark(RIP)

    NEW! Lower prices on all 4D Systems products for 2009 and continuing into 2010!
    http://shop.littlepcbsolutions.com

    Comment


    • #3


      Works great! Thank you!

      Comment

      Working...
      X