Discussion:
wrapwidth of an Editfield
David Johnson
2006-12-28 00:26:17 UTC
Permalink
I can think of another way to get the whole height of the text in the
editfield, if you are interested.
Function EditFieldTextHeight(edtext as editfield) as integer
dim p as picture
dim g as grpahics
Dim rvalue as integer
p = newpicture(10,10,32)
g = p.graphics
g.TextFont = edtext.TextFont
g.TextSize = edtext.TextSize
rvalue = g.stringheight(edtext.text,edtext.width-4)+4
return rvalue
End Function
I just wrote this code off the top of my head so I hope it works, I am
currently not in a situation to test it :-\ basically use
g.stringheight and the editfield width minus 4 because I believe that
there is a 2 pixel buffer. This should then tell you the height of the
rendered text and allow you to set the Editfield, however this method
will not work for an editfield with styled text in it, it will require
a more complicated method which I have buried somewhere.
I found this email in the archives. He is saying, I think, that the
default wrapwidth of an editfield is 4 less than the width:

Editfield1wrapwidth = Editfield1.width - 4

But he does not sound certain. Is this correct?

Thanks,
David

Loading...