Welcome to the XForms FAQ. Last updated March 26, 1996 This FAQ is maintained by Erik Van Riper (geek@imageek.york.cuny.edu) Please send changes or additions to: geek@imageek.york.cuny.edu XForms is Copyright 1995,1996 by T.C. Zhao and Mark Overmars. 1. What is XForms? What is Forms Library? 2. Where can I get XForms from? 3. Is there a mailing list for XForms? 4. Why was I removed from the mailing list? 5. Are the messages from the mailing list archived anywhere? 6. Is there a {text,html,rtf,TeX,non-postscript} form of the docs? 7. I have a nifty neat-o killer app that I just hacked together with XForms. Is there a place I can stick it? 8. Has anyone found a way to interface xforms with C++? (callbacks) 9. C++ with fdesign 10. Why is the canvas window ID different (typically one less) before fl_show_form_window than after? 11. Can I use XForms with FORTRAN? 12. Emulating a button press 13. What is the fastest way to redraw (or force the drawing of) FL_OBJECT? 14. With the latest version of xforms, my panels are flipped with regard to top to bottom placement. 15. When I add a message to a browser, there is an annoying flicker as the browser window is redrawn. Is there a way to prevent that? 16. How do I dynamically resize a form and add room for more objects? 17. I tried to compile the xforms package, but none of the demos would link, as ld didn't like -lXpm... 18. I need a double-click for a browser-line. 19. ld.so.1: essai: fatal: libforms.so: can't open file: errno=2 20. How can I prevent windows from shutting down the entire program when a window is double-clicked to close (not destroyed, but closed.)? -------------------------------------------------------------------------- 1. What is XForms? What is Forms Library? The Forms Library (XForms) is a library of C routines that allows you to build up interaction forms with buttons, sliders, input fields, dials, etc in a very simple way. Following the X tradition, Forms Library does not enforce the look and feel of objects, although in its default state, it does provide a consistent look and feel for all objects. The Forms Library only uses the services provided by Xlib, and should be compatible on all machines that have X installed and have an ANSI compatible compiler. Being based on Xlib, Forms Library is small and efficient. It can be used both in C programs and in C++ programs. -------------------------------------------------------------------------- 2. Where can I get XForms from? XForms can be ftp'd from the following sites: ftp://laue.phys.uwm.edu:/pub/xforms ftp://ftp.cs.ruu.nl/pub/XFORMS (mirror site) ftp://imageek.york.cuny.edu/xforms (mirror site) ftp://fiwi02.wiwi.uni-tuebingen.de/LyX/Xforms (mirror site) -------------------------------------------------------------------------- 3. Is there a mailing list for XForms? A mailing list for news and discussions about XForms is available. To subscribe or unsubscribe, send a message to listserv@ra.york.cuny.edu In the body of the message: subscribe xforms Your Name (to subscribe) unsubscribe xforms (to unsubscribe) help (for help with listserv commands) To use the mailing list, send mail to xforms@ra.york.cuny.edu. Please remember that the message will be sent to hundreds of people (almost 400 at last count). Please DO NOT send subscribe / unsubscribe messages to the list. Send them to listserv@ra.york.cuny.edu. PLEASE NOTE: You will NOT, by default, receive a copy of your own post to the list. -------------------------------------------------------------------------- 4. Why was I removed from the mailing list? The list maintainer does not like to see his mailbox fill up with a week or 10 days worth of bounced messages from the list. Quite often, he ends up with these bounce messages for a week or 10 days, per unreachable host. So, to turn it into as few days of bounced messages as possible, the list maintainer will remove sites that mail is bouncing to from the list. If you notice that you are not getting xforms mail, that means you are probably dropped from the list. -------------------------------------------------------------------------- 5. Are the messages from the mailing list archived anywhere? The mailing list is archived from time to time and placed at ftp://imageek.york.cuny.edu/xforms.mailing.list/ The files are in mailbox format, and compressed using gzip. -------------------------------------------------------------------------- 6. Is there a {text,html,rtf,TeX,non-postscript} form of the docs? There is an HTML format of the manual: http://www.westworld.com/~dau/xforms/forms.html This is a work in progress. -------------------------------------------------------------------------- 7. I have a nifty neat-o killer app that I just hacked together with XForms. Is there a place I can stick it? Sure! Please upload your source (please document it and include a README file) to: ftp://laue.phys.uwm.edu:/pub/xforms/Contrib This way others can share it too. Please also announce it to the XForms mailing list, that way everyone knows it exists. -------------------------------------------------------------------------- 8. Has anyone found a way to interface xforms with C++? (Dealing with callback functions) [Answer provided by Jacques Tremblay (jackt@gel.ulaval.ca)] You cannot set a regular member function as a callback but you can set static member function as a callback and use the u_vdata of the object to store a pointer to the object you want the static function to access. All this is because when a regular member function is called, an implicit pointer is passed as first argument. Here is an example: class MyClass { public: FL_OBJECT *obj; static callback(FL_OBJECT *, long); }; main() { // code to initialize forms MyClass O; O.obj = fl_create_ ... O.obj->u_vdata = (void*)&O; fl_set_object_callback(O.obj,MyClass::callback,0); // And that's about it } -------------------------------------------------------------------------- 9. Now how about using a C++ member function as a callback routine, use fdesign, and not modify the source and header files produced by fdesign? [Answer provided by Jacques Tremblay (jackt@gel.ulaval.ca) What you can do is include the C file generated by fdesign in another C file in which you included your header file before. e.g. in file "interface.c" #include "your_class.h" // now main_window::list_files_callback is defined #include "fdesign_generated_c_file.h" And compile the file interface.c -------------------------------------------------------------------------- 10. Why is the canvas window ID different (typically one less) before fl_show_form_window than after? [Answer provided by Kaz Kylheku (kaz@cafe.net)] Because fl_show_form_window is where the window ID resoure is created with the X server. -------------------------------------------------------------------------- 11. Can I use XForms with FORTRAN? [Answer provided by Robert Williams (bob@bob.usuf2.usuhs.mil)] Just use f2c on your fortran and call the resulting c code from a c wrapper in your xforms applications. -------------------------------------------------------------------------- 12. Emulating a button press To emulate a button press, use fl_trigger_object() or fl_call_object_callback(). -------------------------------------------------------------------------- 13. What is the fastest way to redraw (or force the drawing of) FL_OBJECT? void SyncForm(void) /* redraw Forms parts immediately, as an request Flushes the buffer, tip from xforms author TC */ { FL_Coord x,y; unsigned int keymask; fl_get_mouse(&x,&y,&keymask); return; } -------------------------------------------------------------------------- 14. With the latest version of xforms, my panels are flipped with regard to top to bottom placement. [Answer provided by Steve Lamont (spl@szechuan.ucsd.edu)] Just snarf the .fd file into fdesign and then save it. It automagically fixes the coordinate system. -------------------------------------------------------------------------- 15. When I add a message to a browser, there is an annoying flicker as the browser window is redrawn. Is there a way to prevent that? 1) fl_set_object_dblbuffer(browser,1); (double buffering on the object) 1a) Or, for the whole form: FL_IOPT fl_iopt; /* set double buffering */ fl_iopt.doubleBuffer = 1; fl_set_defaults(FL_PDDouble, &fl_iopt); before you call fl_initialize(). 2) fl_freeze_form(form); 3) buy a faster video card. -------------------------------------------------------------------------- 16. How do I dynamically resize a form and add room for more objects? [Answer provided by Rouben Rostamian (rouben@math.umbc.edu)] /* Freeze sizes of existing objects so that they are not affected when the form size changes below. */ fl_set_object_resize(button1, FL_RESIZE_NONE); /* Make sure the objects float to the top as form is resized. */ fl_set_object_gravity(button1, NorthGravity, ForgetGravity); /* Repeat the two commands above for every object on the form */ /* Resize */ fl_set_form_size(form, newwidth, newheight); /* Add new objects. Note that the existing objects have floated to the top */ ... /* Restore resizing capability. */ fl_set_object_resize(button1, FL_RESIZE_ALL); /* Repeat for all objects */ -------------------------------------------------------------------------- 17. I tried to compile the xforms package, but none of the demos would link, as ld didn't like -lXpm... You need to have the xpm library to use the static library. The shared library of xforms, however, has the xpm stuffed in. Xpm is a pixmap library, try ftp.x.org, or use archie to search for a site near you. -------------------------------------------------------------------------- 18. I need a double-click for a browser-line. There is a funciton fl_set_broswer_dblclick_callback. There aren't generic event specific callbacks. -------------------------------------------------------------------------- 19. ld.so.1: essai: fatal: libforms.so: can't open file: errno=2 A few answers..... > > Most likely your LD_LIBRARY_PATH is not properly set: you should > > add to it the absolute pathname of the directory where the > > libforms.so file is. For more info: 'man ld'. > > .. or if s/he's on a Solaris 2.x system add -R/usr/local/lib/ or the path > wherever the xform library resides. .. or put libforms.a and libforms.so.?? in /usr/lib so that ld and ld.so to the Right Thing automagically. .. or not use dynmically loaded libraries for an API that's still in some state of flux. -------------------------------------------------------------------------- 20. How can I prevent windows from shutting down the entire program when a window is double-clicked to close (not destroyed, but closed.)? check out fl_set_atclose and fl_set_form_atclose. --------------------------------------------------------------------------