Documentation for Win32lib v0.60.6
Table of Contents

Text

Routines that deal with text output.


  • func drawText(integer id, sequence text, object rect, object flags, integer tabsize, integer left, integer right)    Places the text into the rectangle (/i rect) wrapping words if necessary.
  • proc textOut( atom HDC, sequence TextDef )   Writes text to a control.
  • func textRect(integer id,sequence text,object rect,object flags,integer tabsize,integer left,integer right)   Calculates the RECT structure need to draw all the text.

    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    drawText
    (integer id, sequence text, object rect, object flags, integer tabsize, integer left, integer right)

    Places the text into the rectangle (/i rect) wrapping words if necessary.

    Returns: SEQUENCE: {height, count, {left, top, right, bottom} }

    Category: Text

    This returns a sequence of three values: The height, in pixels, of the text drawn, and the number of characters used that could fit into the rectangle specified, and the dimensions of the rectangle used. This rectangle is returned in the same format as the input parameter rect

    Example:

              sequence result
              sequence rect
              result = drawText(myWind, "Fourscore and twenty years ago, our fathers, ...",
                       {5,5,140, 75}, DT_WORDBREAK, 4, 0, 0)
              textheight = result[1]
              textcnt= result[2]
              rect = result[3]
    

    See Also: textOut, textRect


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    textOut
    ( atom HDC, sequence TextDef )

    Writes text to a control.

    Category: Text

    This is a special version of wPuts that can be faster under certain circumstances.
    HDC is the Device Context of a control and not its Id. This can be obtained by getDC() or assignFont(). And must be released after use.
    TextDef is a sequence of up to 7 elements. Elements 4 thru 7 are optional and can be 'omitted' by using an empty sequence for them.
    The elements are ...
    pTextDefn[1] = text string to display. pTextDefn[2] = x (horizontal pixel position) pTextDefn[3] = y (vertical pixel position) pTextDefn[4] = Foregroud color pTextDefn[5] = Background color pTextDefn[6] = Mode (OPAQUE or TRANSPARENT) pTextDefn[7] = Vertical Alignment with respect to character height. (AlignTop, AlignBottom, AlignBaseline)

    Example:

          atom hdc
          hdc = assignFont(Mypixmap)
          H = getTextHeight(Mypixmap, "|")
          W = 4
          textOut(hdc,{"   Name:", W, 0 * H, Black, White, OPAQUE})
          textOut(hdc,{"Address:", W, 1 * H})
          textOut(hdc,{"    Age:", W, 2 * H})
          textOut(hdc,{" Weight:", W, 3 * H})
    

    W = getTextWidth(Mypixmap, "_") * 9 textOut(hdc,{NameFld, W, 0 * H, Blue, BrightWhite}) textOut(hdc,{AddressFld, W, 1 * H}) textOut(hdc,{sprintf("%d",AgeFld), W, 2 * H}) textOut(hdc,{sprintf("%5.2f", WeightFld), W, 3 * H}) releaseDC(Mypixmap)

    See Also: drawText, textRect


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    textRect
    (integer id,sequence text,object rect,object flags,integer tabsize,integer left,integer right)

    Calculates the RECT structure need to draw all the text.

    Returns: SEQUENCE: {left, top, right, bottom}

    Category: Text

    l rect defines the left, top and maximum right pixel (for multiple line text) Example:

              sequence result
              result = textRect(myWind, "Fourscore and twenty years ago, our fathers, ...",
                       {5,5,140, 75}, DT_WORDBREAK, 4, 0, 0)
    

    See Also: drawText, textOut