/****************************************************************
 ***                                                          ***
 ***   Test Optional Entry                                    ***
 ***                                                          ***
 ***************************************************************/
#include "EZ.h"

static char *colors[] = {
  "red",
  "green",
  "blue",
  "yellow",
  "cyan",
  "magenta",
  "white",
  "gainsboro   fd af d  f  d a   fd sa f  fdsa   fdsaf  fdsa ",
  "PapayaWhip",
  "PeachPuff",
};

static void entry_callback(EZ_Widget *, void *);

static void entry_motioncallback(widget, ddd)
     EZ_Widget *widget; void *ddd;
{
  printf("%lx ==> %s\n",widget, EZ_GetEntryString(widget));
}

main(int ac, char **av)
{
  EZ_Widget *frame1, *oe1, *oe2;
  int       i;

  EZ_Initialize(ac,av,0);
  frame1 = EZ_CreateFrame(NULL,NULL);
  oe2 =  EZ_CreateOptionalEntry(frame1, "this is a test", 1,1); /* remember history */
  oe1 = EZ_CreateOptionalEntry(frame1, "this is a test", 0,1);  /* does not remember*/
  EZ_ConfigureWidget(oe1, EZ_CALLBACK, entry_callback, NULL, 0);
  EZ_AddWidgetCallBack(oe1, EZ_MOTION_CALLBACK,entry_motioncallback, NULL, 0);

  EZ_SetOptionalEntryOptionalItems(oe1, colors, 10);
  EZ_DisplayWidget(frame1);
  EZ_EventMainLoop();
}

static void entry_callback(EZ_Widget *widget, void *ddd)
{
  char *str = EZ_GetOptionalEntryString(widget);
  printf("You've entered: \"%s\"\n", str);
  EZ_ConfigureWidget(widget, EZ_FOREGROUND,str,0);  
}
/************************************************************************/



