/* This is a crazy demo showing the "use" of changing
   fields in objects.
*/

#include "forms.h"

int
main(int argc, char *argv[])
{
  FL_FORM *form;
  FL_OBJECT *but, *obj;
  float dx = 5.0, dy = 7.0;

  fl_initialize(argv[0], "FormDemo", 0, 0 ,&argc, argv);
  form = fl_bgn_form(FL_BORDER_BOX,400.0,200.0);
    but = fl_add_button(FL_NORMAL_BUTTON,140.0,160.0,60.0,30.0,"Exit");
  fl_end_form();

  fl_show_form(form,FL_PLACE_SIZE,FL_NOBORDER,NULL);
  do
  {
    if (but->x + dx < 5.0 || but->x + but->w + dx >395.0) dx = -dx;
    if (but->y + dy < 5.0 || but->y + but->h + dy >195.0) dy = -dy;
    but->x += dx;
    but->y += dy;
    fl_redraw_form(form);
    obj = fl_check_forms();
  } while (obj != but);
  fl_hide_form(form);
  return 0;
}
