getTextExtent do not work
- Posted by Bent Olsen <microprog at YAHOO.COM> Jan 28, 2000
- 432 views
--0-846930886-949084778=:22955 Content-Disposition: inline Greetings, Can some one tell me why this does not work? I'm using win 3.11 with win32s extension. I have attached txtextnt.exw and ex.err Bent. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com --0-846930886-949084778=:22955 Content-Description: TXTEXTNT.EXW Content-Disposition: inline; filename="TXTEXTNT.EXW" 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 ) -- show results wPrintf( MyWindow, "The string %s is %d by %d", {string, extent[1], extent[2]} ) -- WinMain( MyWindow, Normal ) --0-846930886-949084778=:22955 Content-Description: EX.ERR Content-Disposition: inline; filename="EX.ERR" C:\EUPHORIA\include\win32lib.ew:628 in procedure abortErr() attempt to divide by 0 s = {103'g',101'e',116't',84'T',101'e',120'x',116't',69'E',120'x', 116't',32' ',102'f',97'a',105'i',108'l',101'e',100'd',46'.'} ... called from C:\EUPHORIA\include\win32lib.ew:5662 in function getTextExtent() id = 3 text = {72'H',105'i',44',',32' ',116't',104'h',101'e',114'r',101'e', 33'!'} width = <no value> height = <no value> size = 2263416880 string = 2263420912 ... called from C:\EUPHORIA\TEMP\TXTEXTNT.EXW:13 Global & Local Variables C:\EUPHORIA\include\machine.e: check_calls = 1 C:\EUPHORIA\include\msgbox.e: lib = 21342 msgbox_id = 0 get_active_id = 1 C:\EUPHORIA\include\file.e: SLASH = 92'\' my_dir = -2 C:\EUPHORIA\include\get.e: input_file = <no value> input_string = <no value> string_next = <no value> ch = <no value> C:\EUPHORIA\include\graphics.e: BLUE = 1 CYAN = 3 RED = 4 BROWN = 6 BRIGHT_BLUE = 9 BRIGHT_CYAN = 11 BRIGHT_RED = 12 YELLOW = 14 C:\EUPHORIA\include\image.e: fn = <no value> error_code = <no value> numXPixels = <no value> numYPixels = <no value> bitCount = <no value> numRowBytes = <no value> startXPixel = <no value> startYPixel = <no value> endYPixel = <no value> C:\EUPHORIA\include\win32lib.ew: ok = 1 user32 = 21342 gdi32 = 21342 winmm = 15070 comdlg32 = 16534 comctl32 = 21126 kernel32 = 21342 shell32 = 21462 xCleanUp = 1 showWarnings = 1 strings = {} allottedSize = 0 classes = 37'%' Screen = 1 Printer = 2 className = {0,{98'b',117'u',116't',116't',111'o',110'n'},{98'b',117'u', 51'3',50'2'},0,0,0} classType = {0,1,1,1,1,1,1,4,4,2,2,2,2,3,3,6,6,6,5,5,6,6,7,8,9,10, 11,11,1,1,1,11,11,11,0,0,0} classStyle = {0,1342242816,1342242817,1342242819,1342242822,1342242825, classStyleEx = {0,0,0,0,0,0,0,528,528,512,512,512,512,528,528,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} WndProcAddress = 2267170880 onMouse = {-1,-1,-1} onClick = {-1,-1,-1} onKeyPress = {-1,-1,-1} onKeyUp = {-1,-1,-1} onKeyDown = {-1,-1,-1} onResize = {-1,-1,-1} onChange = {-1,-1,-1} onGotFocus = {-1,-1,-1} onLostFocus = {-1,-1,-1} onScroll = {-1,-1,-1} onOpen = {-1,-1,-1} onClose = {-1,-1,-1} onDestroy = {-1,-1,-1} onTimer = {-1,-1,-1} onPaint = {-1,-1,-1} onDragAndDrop = {-1,-1,-1} onEvent = {-1,-1,-1} mainWindow = 3 modalWindow = 0 modalStack = {} paintDC = {} myId = {} myReturn = {} window_handle = {-1,-1,25012} window_func = {-1,-1,-1} window_class = {-1,-1,0} window_type = {36'$',37'%',1} window_focus_order = {{},{},{}} window_focus = {0,0,0} window_owner = {0,0,0} window_menu = {0,0,0} window_toolbar = {0,0,0} window_statusbar = {0,0,0} window_tooltip = {{},{},{}} window_font = {{{},0,0,0},{{},0,0,0},{{},0,0,0}} window_fcolor = {0,0,0} window_bcolor = {16777215,16777215,16777215} window_pen = {{0,0,0,13,1,1},{0,0,0,13,1,1},{0,0,0,13,1,1}} window_x = {0,0,0} window_y = {0,0,0} window_scroll = {{1,10},{1,10},{1,10}} window_range = {{1,10},{1,10},{1,10},{0,100'd'}} window_tabitems = {{},{},{}} window_group = {{},{},{}} window_cursor = {0,0,0} window_hotkeys = {{},{},{}} tooltipControl = 0 tooltipWindow = 0 tooltipState = 0 tooltipMouseX = -1 tooltipMouseY = -1 tooltipX = 0 tooltipY = 0 tooltipShow = 1 tooltipCovers = 0 transColor = 16711935 heldResource = {} heldCursor = {} printerDC = 0 grabbedHDC = {} regCount = 1 customColors = 2266562432 i = 63'?' hintFontSize = 8 hintFontAttrib = 0 hintFontName = {77'M',83'S',32' ',83'S',97'a',110'n',115's',32' ', 83'S',101'e',114'r',105'i',102'f'} xpmErrFlag = <no value> transTuple = {255,0,255} C:\EUPHORIA\TEMP\TXTEXTNT.EXW: text = {72'H',105'i',44',',32' ',116't',104'h',101'e',114'r',101'e', 33'!'} extent = <no value> Traced lines leading up to the failure: C:\EUPHORIA\include\win32lib.ew:12144 elsif iMsg = WM_DROPFILES then C:\EUPHORIA\include\win32lib.ew:12150 elsif iMsg = WM_COMMAND then C:\EUPHORIA\include\win32lib.ew:12222 elsif iMsg = WM_PAINT then C:\EUPHORIA\include\win32lib.ew:12281 elsif iMsg = WM_VSCROLL C:\EUPHORIA\include\win32lib.ew:12291 elsif iMsg = WM_TIMER then C:\EUPHORIA\include\win32lib.ew:12313 elsif iMsg = WM_SYSCOLORCHANGE then C:\EUPHORIA\include\win32lib.ew:12322 elsif iMsg = WM_CTLCOLORBTN C:\EUPHORIA\include\win32lib.ew:12344 elsif iMsg = WM_CREATE then C:\EUPHORIA\include\win32lib.ew:12356 elsif iMsg = WM_CLOSE then C:\EUPHORIA\include\win32lib.ew:12378 elsif iMsg = WM_DESTROY then C:\EUPHORIA\include\win32lib.ew:12389 elsif iMsg = WM_NOTIFY then C:\EUPHORIA\include\win32lib.ew:12429 result = popSelf() C:\EUPHORIA\include\win32lib.ew:10994 returns = myReturn[length(myReturn)] C:\EUPHORIA\include\win32lib.ew:10997 myId = myId[1..length(myId)-1] C:\EUPHORIA\include\win32lib.ew:10998 myReturn = myReturn[1..length(myReturn)-1] C:\EUPHORIA\include\win32lib.ew:11000 return returns C:\EUPHORIA\include\win32lib.ew:12431 return c_func( xDefWindowProc, { hWnd, iMsg, wParam, lParam } ) C:\EUPHORIA\include\win32lib.ew:625 if xCleanUp > -1 then C:\EUPHORIA\include\win32lib.ew:626 call_proc( xCleanUp, {} ) C:\EUPHORIA\include\win32lib.ew:4625 held = heldResource C:\EUPHORIA\include\win32lib.ew:4628 for i = 1 to length( held ) do C:\EUPHORIA\include\win32lib.ew:4635 for i = 1 to length( heldCursor ) do C:\EUPHORIA\include\win32lib.ew:4639 heldCursor = {} C:\EUPHORIA\include\win32lib.ew:4641 end procedure C:\EUPHORIA\include\win32lib.ew:628 ok = 1/0 --0-846930886-949084778=:22955--