Re: getTextExtent do not work
- Posted by "Cuny, David at DSS" <David.Cuny at DSS.CA.GOV> Jan 28, 2000
- 441 views
Bent Olsen wrote: > Can some one tell me why this does not work? My intitial thought was that getTextExtent calls a routine that's not implemented in Win32s, but the routines linkFunc and linkProc are supposed to display an error if that's the case. I rewrote the example to put the text display inside of an onPaint routine, and it works fine on my machine: -- David Cuny -- BEGIN EXAMPLE -- include win32lib.ew constant MyWindow = create( Window, "Simple Window", 0, Default, Default, 200, 100, 0 ) -- show the metrics of the string sequence text, extent -- the string to measure text = "Hi, there!" -- measure the string extent = getTextExtent( MyWindow, text ) procedure Paint( int x, int y, int cx, int cy ) -- show results wPrintf( MyWindow, "The string %s is %d by %d", {text, extent[1], extent[2]} ) end procedure onPaint[MyWindow] = routine_id("Paint") WinMain( MyWindow, Normal ) -- END EXAMPLE --