|Century Embedded Technologies Nano-X SDK and Developer's Guide|
|Prev||Appendix E. Forms Compatibility||Next|
Many parts of XForms use X-specific structures like XEvent in their interface. I did not emulate these! Unfortunately these features (such as the "canvas" widget) are needed by most large programs. You will need to rewrite these to use FLTK subclasses.
Fl_Free widgets emulate the old Forms "free" widget. It may be useful for porting programs that change the handle() function on widgets, but you will still need to rewrite things.
All instance variables are hidden. If you directly refer to the x, y, w, h, label, or other fields of your Forms widgets you will have to add empty parenthesis after each reference. The easiest way to do this is to globally replace "->x" with "->x()", etc. Replace "boxtype" with "box()".
const char * arguments to most FLTK methods are simply stored, while Forms would strdup() the passed string. This is most noticable with the label of widgets. Your program must always pass static data such as a string constant or malloc'd buffer to label(). If you are using labels to display program output you may want to try the Fl_Output widget.
The default fonts and sizes are matched to the older GL version of Forms, so all labels will draw somewhat larger than an XForms program does.
fdesign outputs a setting of a "fdui" instance variable to the main window. I did not emulate this because I wanted all instance variables to be hidden. You can store the same information in the user_data() field of a window. To do this, search through the fdesign output for all occurances of "->fdui" and edit to use "->user_data()" instead. This will require casts and is not trivial.
The prototype for the functions passed to fl_add_timeout() and fl_set_idle_callback() callback are different.
All the following XForms calls are missing:
FL_RETURN_DBLCLICK (use Fl::event_clicks())
fl_set_form_dblbuffer(), fl_set_object_dblbuffer() (use an Fl_Double_Window instead)
fl_get_object_bbox() (maybe FLTK should do this)
Most drawing functions
fl_set_coordunit() (FLTK uses pixels all the time)
fl_win*() (all these functions)
fl_initialize(argc,argv,x,y,z) ignores last 3 arguments
FL_MENU_BUTTON just draws normally
FL_DIGITAL_CLOCK (comes out analog)
Only some of file selector is emulated
fl_pup*() (all these functions)
textbox object (should be easy but I had no sample programs)