/* This demo shows the use of a touch buttons.
*/

#include <stdio.h>
#include "forms.h"

int
main(int argc, char *argv[])
{
  FL_FORM *form;
  FL_OBJECT *retobj, *lleft, *left, *right, *rright, *button, *value;
  int val;
  char str[30];

  fl_initialize(argv[0], "FormDemo", 0, 0 ,&argc, argv);
  form = fl_bgn_form(FL_UP_BOX,360,140);
     lleft = fl_add_button(FL_TOUCH_BUTTON,50,80,40,30,"<<");
     left = fl_add_button(FL_TOUCH_BUTTON,90,80,40,30,"<");
     value = fl_add_box(FL_BORDER_BOX,130,80,100,30,"");
     fl_set_object_color(value,FL_LEFT_BCOL,FL_LEFT_BCOL);
     right = fl_add_button(FL_TOUCH_BUTTON,230,80,40,30,">");
     rright = fl_add_button(FL_TOUCH_BUTTON,270,80,40,30,">>");
     button = fl_add_button(FL_NORMAL_BUTTON,220,20,100,30,"Exit");
  fl_end_form();

  fl_show_form(form,FL_PLACE_CENTER,FL_NOBORDER,NULL);
  val = 0;
  do
  {
    sprintf(str,"%d",val);
    fl_set_object_label(value,str);
    retobj = fl_do_forms();
    if (retobj == lleft) val -= 5;
    if (retobj == left) val -= 1;
    if (retobj == right) val += 1;
    if (retobj == rright) val += 5;
  } while (retobj != button);
  fl_hide_form(form);
  return 0;
}
