Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Height of Text
Message
From
20/02/2002 04:37:09
 
 
To
19/02/2002 11:32:25
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00621982
Message ID:
00622401
Views:
34
>Hi All,
>
>How can I calculate the height of a control (editbox) to show all lines of a string?
>
>Thanks in advance
>
>Agnes

Agnes,

this seems to work (more or less)
_edit = editbox
&& form.Keypress
LPARAMETERS nkeycode,nshiftaltctrl

if( chr(nkeycode) == 't' )
	NODEFAULT
	
	local th, i, nlines, aa[1], OneLineHeight, EditBoxWidth
	
	th = thisform.TextHeight(thisform._edit.value)
	nlines = alines(aa, thisform._edit.value, .F.)
	acti screen
	?'--'
	?thisform._edit.Value
	?'--'
	
	if( !empty(nLines) )
		OneLineHeight = th/nlines
		acti screen
		?th, OneLineHeight 
		EditBoxWidth = thisform._edit.Width - iif(!empty(thisform._edit.Scrollbars), sysmetric(SYSMETRIC_VSCROLLBARWIDTH), 0)
		for i = 1 to nlines
			if( thisform.textwidth(aa[i]) > EditBoxWidth )
				th = th + OneLineHeight 
			endif
		endfor
	endif
	
	thisform._Edit.Height = max(th, 45) && or scrollbars disappear
	acti screen
	?th
else
	return DoDefault(nkeycode,nshiftaltctrl)
endif
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform