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.
Fl_Timer widgets are provided to emulate the XForms timer. These work, but are quite inefficient and inaccurate compared to using Fl::add_timeout().
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_REVISION, fl_library_version()
FL_RETURN_DBLCLICK (use Fl::event_clicks())
fl_add_signal_callback()
fl_set_form_atactivate() fl_set_form_atdeactivate()
fl_set_form_property()
fl_set_app_mainform(), fl_get_app_mainform()
fl_set_form_minsize(), fl_set_form_maxsize()
fl_set_form_event_cmask(), fl_get_form_event_cmask()
fl_set_form_dblbuffer(), fl_set_object_dblbuffer() (use an Fl_Double_Window instead)
fl_adjust_form_size()
fl_register_raw_callback()
fl_set_object_bw(), fl_set_border_width()
fl_set_object_resize(), fl_set_object_gravity()
fl_set_object_shortcutkey()
fl_set_object_automatic()
fl_get_object_bbox() (maybe FLTK should do this)
fl_set_object_prehandler(), fl_set_object_posthandler()
fl_enumerate_fonts()
Most drawing functions
fl_set_coordunit() (FLTK uses pixels all the time)
fl_ringbell()
fl_gettime()
fl_win*() (all these functions)
fl_initialize(argc,argv,x,y,z) ignores last 3 arguments
fl_read_bitmapfile(), fl_read_pixmapfile()
fl_addto_browser_chars()
FL_MENU_BUTTON just draws normally
fl_set_bitmapbutton_file(), fl_set_pixmapbutton_file()
FL_CANVAS objects
FL_DIGITAL_CLOCK (comes out analog)
fl_create_bitmap_cursor(), fl_set_cursor_color()
fl_set_dial_angles()
fl_show_oneliner()
fl_set_choice_shortcut(a,b,c)
command log
Only some of file selector is emulated
FL_DATE_INPUT
fl_pup*() (all these functions)
textbox object (should be easy but I had no sample programs)
xyplot object