Drawstring anomoly

  1. 2 weeks ago

    Dave S

    Jun 10 San Diego, California USA

    I am writing text to a Canvas.... this is a trimmed down version (the full version has color logic in it)

    x=10
    y=g.textascent
    for i=0 to lines.ubound
      if y>=g.height then exit for
      // determine line colors
     w=g.width-1
    s=lines(i)
    g.drawstring s,x,y,w,False
    y=y+g.textheight
    next i

    SOMETIMES if the size of the graphic area is slightly larger than a multiple of textheight the last line of text seems to wrap, and print over itself..
    if I drag the window just a tad, it "fixes" itself. But the drawstring should not exceed one line regardless

    If I change FALSE to true, it does not wrap, but also draws "..." where I want the line to clip

    Solved... it had to do with the fact that the string had TAB (chrb(9)) embedded.... once those were expanded to 4 spaces it worked out just right

  2. Dave S

    Jun 10 Answer San Diego, California USA

    Solved... it had to do with the fact that the string had TAB (chrb(9)) embedded.... once those were expanded to 4 spaces it worked out just right

  3. Dave S

    Jun 10 San Diego, California USA

    @Tim P So your goal is to get the text to clip? The documentation says omitting WrapWidth will draw the text on one line.

    you are correct... and the reason I only saw it on the last line was the previous lines cleared their background first....

or Sign Up to reply!