1. getTextExtent do not work
- Posted by Bent Olsen <microprog at YAHOO.COM> Jan 28, 2000
- 434 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--
2. Re: getTextExtent do not work
- Posted by "Cuny, David at DSS" <David.Cuny at DSS.CA.GOV> Jan 28, 2000
- 442 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 --
3. Re: getTextExtent do not work
- Posted by Irv Mullins <irv at ELLIJAY.COM> Jan 28, 2000
- 410 views
----- Original Message ----- From: Bent Olsen <microprog at YAHOO.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Friday, January 28, 2000 1:39 PM Subject: getTextExtent do not work > 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 > ---------------------------------------------------------------------------- ---- > 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 ) > ---------------------------------------------------------------------------- ---- > 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',101'e',110'n',116't',58':',71'G',101'e',116't',84'T',101'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 = > 116't',116't',111'o',110'n'},{98'b',117'u',116't',116't',111'o',110'n'}, > {98'b',117'u',116't',116't',111'o',110'n'},{98'b',117'u',116't',116't', > 111'o',110'n'},{98'b',117'u',116't',116't',111'o',110'n'},{108'l',105'i', > 115's',116't',98'b',111'o',120'x'},{108'l',105'i',115's',116't',98'b', > 111'o',120'x'},{99'c',111'o',109'm',98'b',111'o',98'b',111'o',120'x'}, > {99'c',111'o',109'm',98'b',111'o',98'b',111'o',120'x'},{99'c',111'o', > > 98'b',111'o',120'x'},{101'e',100'd',105'i',116't'},{101'e',100'd',105'i', > 116't'},{115's',116't',97'a',116't',105'i',99'c'},{115's',116't',97'a', > 116't',105'i',99'c'},{115's',116't',97'a',116't',105'i',99'c'},{115's', > > 111'o',108'l',108'l',98'b',97'a',114'r'},{115's',116't',97'a',116't', > > 111'o',111'o',108'l',98'b',97'a',114'r',87'W',105'i',110'n',100'd',111'o', > > 116't',97'a',116't',117'u',115's',98'b',97'a',114'r',51'3',50'2'},{98'b', > 117'u',116't',116't',111'o',110'n'},{98'b',117'u',116't',116't',111'o', > 110'n'},{98'b',117'u',116't',116't',111'o',110'n'},{109'm',115's',99'c', > 116't',108'l',115's',95'_',116't',114'r',97'a',99'c',107'k',98'b',97'a', > > 114'r',97'a',99'c',107'k',98'b',97'a',114'r',51'3',50'2'},{83'S',121'y', > 115's',84'T',97'a',98'b',67'C',111'o',110'n',116't',114'r',111'o',108'l', > 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 = > , > , > 1342177283,1342177294,0,0,0,0,1417674757,1409286147,1342242944,1342246915, > 1342247043,1342242849,1342242851,1375797248,0,0,0} > 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 ength( 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 > >
4. Re: getTextExtent do not work
- Posted by Irv Mullins <irv at ELLIJAY.COM> Jan 28, 2000
- 425 views
----- Original Message ----- From: Bent Olsen <microprog at YAHOO.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Friday, January 28, 2000 1:39 PM Subject: getTextExtent do not work > 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 Hi, Try the following code, which works on Win 98. If it fails on Win 3.11, then the problem must be with win32s. Regards, Irv -- code generated by Win32Lib IDE v0.8 include Win32Lib.ew without warning ---------------------------------------------------------------------------- ---- -- Window Window1 global constant Window1 = create( Window, "Test Extent", 0, Default, Default, 350, 250+ 19, 0 ) global constant LText1 = create( LText, "LText1", Window1, 33, 45, 268, 36, 0 ) ---------------------------------------------------------------------------- ---- procedure Window1_onClick () end procedure onClick[Window1] = routine_id("Window1_onClick") ---------------------------------------------------------------------------- ---- procedure Window1_onOpen () object extent, text text = "Hi There!" extent = getTextExtent(Window1,text) setText(LText1,sprintf("Extent of %s is %d x %d",{text,extent[1],extent[2]})) end procedure onOpen[Window1] = routine_id("Window1_onOpen") WinMain( Window1, Normal )