[Win32Lib] drawText question
- Posted by DanM Feb 06, 2009
- 778 views
I'm trying to use drawText in a sequence of draws, so I can put part of some text on a window, then another part in a different color right after the first part, then the rest of the first part after that. But the info returned from the function doesn't seem to be what I thought the doc said it would be, which isn't letting me use it as I thought I could.
I wanted to use drawText because I was thinking that the return from drawText would give me the rectangle that the specified text was drawn in, so I could use that info to emulate html links, such that mouse clicks on some tagged portion of text could be programmatically acted upon, like html jumps to another file or place in a file.
The Win32Lib doc says of the return from drawText:
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.
My problem is that I'm interpreting the words "...dimensions of the rectangle used" to mean the rectangle that ONLY encompasses the space taken up by the specified text, NOT the FULL rectangle into which the text was to be drawn, as a return of the FULL size of rectangle to be drawn into is redundent, as it was already specified in invoking the function, as below.
drawText (integer id, sequence text, object rect, object flags, integer tabsize, integer left, integer right)
object rect is the definition of the points describing the rectangular space to draw the text into.
Of course, I don't see any reason (right now) why I couldn't get what I want by just using wPuts & keeping track of where each tagged word is as it's written, but I thought drawText would be easier, if I understood the returned info correctly.
Have I misunderstood what's supposed to be returned by drawText?
Dan