FL_Button / FL_Event

18 views
Skip to first unread message

holm.h...@gmail.com

unread,
Oct 20, 2017, 5:31:16 AM10/20/17
to fltk.general

Hello,

I add the following code to test/button.cxx, subroutine beepcb:
  printf("Event: %d %d %d\n",
     Fl::event_button1(),
     Fl::event_button2(),
     Fl::event_button3() );
This line however prints out "0 0 0", whatever button I click.

If I change the button to be clicked to FL_Repeat_Button it works just fine:
From
  Fl_Button *b1 = new Fl_Button(20, 20, 80, 25, "&Beep");
To:
  Fl_Repeat_Button *b1 = new Fl_Repeat_Button(20, 20, 80, 25, "&Beep");


Why do this not for FL_Button ?

Best regards
Håvard

holm.h...@gmail.com

unread,
Oct 20, 2017, 6:01:51 AM10/20/17
to fltk.general

Found the answer : The callback happen when the mouse is released (not pressed), and at that time the neigther of the mouse-buttons is pressed.

Best regards
Håvard

Greg Ercolano

unread,
Oct 20, 2017, 10:57:12 AM10/20/17
to fltkg...@googlegroups.com
On 10/20/17 03:01, holm.h...@gmail.com wrote:
>
> Found the answer : The callback happen when the mouse is released (not pressed), and at that time the neigther of the mouse-buttons is pressed.

If you set b1->when(FL_WHEN_CHANGED), you'll get a callback
when a button is both pushed and released.
Reply all
Reply to author
Forward
0 new messages