DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: http://www.fltk.org/str.php?L2729
Version: 1.3-current


In my tests, the FL_WHEN_ENTER_KEY part *does* work as expected, i.e. the
callback is called when I press ENTER. However, I can see that pressing
TAB to leave the input field doesn't call the callback. See attached
simple test case spinner.cxx.

I'm not convinced that adding FL_WHEN_CHANGED is the correct solution, but
I'm not sure about it. However, I believe that pressing TAB (or clicking on
another widget *should* trigger the callback, if FL_WHEN_RELEASE is set
(unfortunately my simple test case doesn't contain other widgets...).


Link: http://www.fltk.org/str.php?L2729
Version: 1.3-current
// file: spinner.cxx
// use: "fltk-config --compile spinner.cxx" to compile
#include <FL/Fl_Window.H>
#include <FL/Fl_Spinner.H>
#include <FL/Fl_Box.H>
#include <FL/Fl.H>
#include <stdio.h>

void spinner_cb(Fl_Widget *w, void *v) {
  Fl_Spinner *s = (Fl_Spinner *)w;
  Fl_Box *message = (Fl_Box *)v;
  int val = (int)s->value();
  static char buf[100];
  sprintf(buf,"received callback: value = %d",val);
  message->label(buf);
  message->redraw();
  printf("%s\n",buf); fflush(stdout);
}

int main (int argc, char **argv) {
  Fl_Window *win1 = new Fl_Window(250,150);
  Fl_Spinner *spinner = new Fl_Spinner(50,10,100,80);
  Fl_Box *message = new Fl_Box(10,110,230,30);
  message->label("callbacks will show up here ...");
  win1->end();
  spinner->callback(spinner_cb,message);
  win1->show(argc,argv);
  return Fl::run();
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to