On May 2, 2006, at 1:02 PM, Tony Cerrato wrote:
Hola,
If I wanted to create an EditField that would resize itself to
accommodate any amount of text the user might input - how would I
do that? What properties would I reference to know the width of the
characters within the EditField?
Assuming that the EditField is not styled, here's the code I use.
Sub TextChange()
dim lineCount as Integer = Max(me.LineNumAtCharPos(Len(me.text)) +
1, 1)
me.height = lineCount*me.TextHeight(me.TextFont, me.textSize) + 7
me.ScrollPosition = 0
Resized
End Sub
Resized is a new event.
Private Function TextHeight(fontName as String, fontSize as Integer)
as Integer
dim p as new Picture(1, 1, 32)
If p.Graphics is nil then //file a bug report
Return 0
End if
p.Graphics.TextFont = fontName
p.Graphics.TextSize = fontSize
Return p.Graphics.TextHeight
End Function
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>