chapman@lll-lcc.UUCP (Carol Chapman) (04/27/89)
I find the documentation for Athena text widgets rather obscure, so I'm hoping that some of you who have dealt with this before can answer my questions ... My setup: My widget msg_text is of asciiDiskWidgetClass, so a file holds the messages to it. XtNeditType is set to XttextAppend and XtNtextOptions are set to scrollOnOverflow|scrollVertical|wordBreak|editable (<- I'm not sure if it does any good to put 'editable' here since I'm in textAppend mode??). Using the text widget, I type a message to my application window that says, "Enter a barcode: ". I would then like the user to type in a barcode which my program can then do marvelous things with! This is the only time the user has to type anything. The rest of the time I use the text widget for displaying my messages to the user. I know my code works ok when I'm displaying messages. I'm just not sure about getting the response from the user. 1. Am I correct to use textAppend and asciiDiskWidgetClass? 2. How do I capture the user's input to a variable? 3. If using asciiDiskWidgetClass is correct, what would be the best way of clearing the file every once in awhile, since this program may be running for days at a time? Should I just close it and then reopen it? I will thank you in advance since our mailer is having problems. We can receive mail, but it's hard to send out right now. carol -- ------------------------------------------------------------------------------- Livermore Lab (chapman@lll-crg.llnl.gov or chapman@lll-lcc.llnl.gov) P.O. Box 808, L-153 Tel. (415) 423-7876 Livermore, CA 94550 "Never own anything that you have to FEED or PAINT."
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (04/27/89)
> I find the documentation for Athena text widgets rather obscure... The programmers have been writing the docs again :-) > scrollOnOverflow|scrollVertical|wordBreak|editable (<- I'm not sure if > it does any good to put 'editable' here since I'm in textAppend > mode??). It does nothing at all in this case, except possiblly give you a warning message. > 1. Am I correct to use textAppend and asciiDiskWidgetClass? Seems fine to me. > 2. How do I capture the user's input to a variable? If you are using an asciii disk widget you can read the file. Yea, that is kind of gross. The other thing you can do is use a disk widget for the output and a string widget for the input. Then if you pass a properly allocated string and lenght of this string (XtNstring and XtNlength) the text widget will use it in place and you can just look at the string. > 3. If using asciiDiskWidgetClass is correct, what would be the best > way of clearing the file every once in awhile, since this program > may be running for days at a time? Should I just close it and > then reopen it? To be safe you should destroy the disk source, remove the file, and then create a new disk source with a new file. Chris D. Peterson MIT X Consortium