Re: XForms: Outputting text to NORMAL_TEXT and NORMAL_BROWSER windows

Steve Lamont (spl@szechuan.ucsd.edu)
Thu, 14 Jan 99 17:43:29 PST

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I have created a form (using fdesign) with various buttons and two text
> windows (at this stage, I am unsure whether to use a NORMAL_TEXT object or
> NORMAL_BROWSWER). Anyway, these two text windows will be used to output
> messages to the user during the execution of callback functions (callback
> functions of the various buttons).
>
> My question is when executing these callback functions, what function do I
> use to output these text messages to the text windows, and what the
> parameters of the function?

I wouldn't use a Text object if I wanted messages to scroll so that
the user could refer back to previous results. I generally use Text
objects for simple one (or more) line readouts that simply get
replaced as the program goes through its paces.

The Browser object is probably the easiest to use, since you can use
the function fl_addto_browser() to simply tack messages on to the
Browser. (Hint: vsprintf() and stdarg.h is your friend here.) You
will probably want to also scroll the messages so that the most recent
message is visible in the Browser.

To do this you will need to use a combination of
fl_get_browser_screenlines(), fl_get_browser_topline(),
fl_get_browser_maxline(), and fl_set_browser_topline(). In the
immortal words of nearly every math textbook I own, the exact
algorithm "is left as an exercise for the student." :-)

There is another possiblity that you may wish to consider: the
Command Log goodie. While you can't paste it directly into your
form(s), it performs more or less the function you're describing,
although I don't think you can have more than one instance of a
Command Log.

Check the manual for full details.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/