Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!uflorida!bikini!thoth From: thoth@reef.cis.ufl.edu (Gilligan) Newsgroups: comp.windows.x Subject: Re: question about the Athena Text Widget. Message-ID: Date: 31 Aug 90 20:52:52 GMT Sender: news@uflorida.cis.ufl.EDU Distribution: comp Organization: Zik Zak Lines: 52 There is no way I know of to discover the end of the text widget without using procedures private to the AsciiSource. Scanning for a null in XtNstring will NOT do the job. What if someone inserts a nul into the text,? it's legal and possibly desirable. There is a procedure in the AsciiSrc class rec that you can access with asciiSrcClassRec.text_src_class.Scan. It points to the procedure /* Function Name: Scan * Description: Scans the text source for the number and type * of item specified. * Arguments: w - the AsciiSource widget. * position - the position to start scanning. * type - type of thing to scan for. * dir - direction to scan. * count - which occurance if this thing to search for. * include - whether or not to include the character found in * the position that is returned. * Returns: the position of the item found. * * Note: While there are only 'n' characters in the file there are n+1 * possible cursor positions (one before the first character and * one after the last character. */ static XawTextPosition Scan (w, position, type, dir, count, include) Widget w; XawTextPosition position; XawTextScanType type; XawTextScanDirection dir; int count; Boolean include; { And I usually call it like this. length = (asciiSrcClassRec.text_src_class.Scan)(source, 0, XawstAll, XawsdRight, 1, True); The problem with this is that it is completely undocumented and probably unsupported. You have to #include to get the structure definitions and #defines. Is there a better way? -- /-------------------- "a window is a terrible thing to paste" -me ( My name's not really Gilligan, It's Robert Forsman, without an `e' ) --------------------/