Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!bloom-beacon!EXPO.LCS.MIT.EDU!kit From: kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) Newsgroups: comp.windows.x Subject: Re: Getting more information from the textWidget Message-ID: <8908241802.AA28420@expo.lcs.mit.edu> Date: 24 Aug 89 18:02:12 GMT References: <962@pcsbst.UUCP> Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 39 > 1. When the user clicks on a line, I need to know what line was clicked. I've > defined my own selectionType array that disallows all but line selection, > but querying the selection only gives me start and ending character > positions. Given that the text widget keeps an internal line table, it > seems a real shame that I have to duplicate its work by building a line > table of my own and translating the start/end positions into a line number > by brute force. The line table kept by the text widget does not contain the line number from the top of the file, it only contains the lines that are currently visable on the screen. There is no quick method for determining which line is currently visable. > 2. There doesn't seem to be any way of calling the action proceedures > under program control. This would be useful. A generic method of doing this will be avaliable in the R4 Xt Intrinsics. > I have an application where I need to display a file (quickly) in > a widget and hilight a line in it under program control. I also need > to allow the user to scroll through this file, perhaps clicking on > a line of particular interest (which will become the highlighted line). If you are not interested in editing the file perhaps you would be better served by using a List widget. If you force it to one column, and break your file up into an array of strings (1 per line) then the list widget will highlight by line, and return the item number (which is really the line number) to you quite quickly. Remember, all text need not use the Text widget :-) Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213