Guys,
after the administrivia of the last few days, here's something fun for the
weekend.
The attached file combox.tar.gz expands to a directory combox containing
$ ls
combox.c combox_test.c COPYING fdfix.sh freebrowser.h
combox.h combox_test_gui.fd CREDITS freebrowser.c Makefile
combox.[ch] and freebrowser.[ch] are the source files for a Combox widget. I
have mentioned in the past that LyX uses such a widget and that I planned to
rewrite it in a form that could be added to the xforms library. This I have
now done. I have also obtained the agreement of all authors to release it
under the LGPL.
The widget should work "stand-alone", although I envisage its eventual
incorporation into the library. At present there is obviously no support for
it in fdesign. Hence I have created a little shell script, fdfix.sh, that
will replace a line such as
fdui->combox_commands = obj =
fl_add_choice(FL_NORMAL_CHOICE,181,140,129,30,"Available commands");
with
fdui->combox_commands = obj =
fl_add_combox(FL_NORMAL_COMBOX,181,140,129,30,"Available commands");
(It replaces fl_add_choice with fl_add_combox on any line containing the
string "combox", so just name your widget appropriately.)
To allow those interested to play with this, I have created a demo program
contained in combox_test.c and combox_test_gui.fd. Edit the Makefile to
suit...
The demo shows the combox in action and also implements a simple minibuffer
(similar to emacs' or LyX's). In the example it allows you to input one of a
list of possible commands:
"file-open <name>", "file-close", "say-hello <message>".
The UP and DOWN keys could be used to display the next available and previous
messages. ESC will exit the minibuffer. TAB is used as a completion command.
For example, I type "sa" + TAB in the input widget. The only matching command
is "say-hello", so the code completes this for you.
Alternatively, I type "fi" + TAB. Both "file-open" and "file-close" match, so
the freebrowser widget is displayed allowing you to choose appropriately.
You'll find that ESC now closes the browser.
UP, DOWN allow you to navigate it.
RETURN selects the currently highlighted item.
Any other key-press is returned to the input widget.
Thus "fi" + TAB + 'c' + TAB will result in the command "file-close".
Voila! A working sample implemetation of a minibuffer demonstrating the use of
FL_FREEBROWSER.
Have a fun weekend,
Angus
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
This archive was generated by hypermail 2b29 : Fri Apr 04 2003 - 08:50:33 EST