FLTK logo

[fltk.general] possible keypad shortcut bug or docs typo

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

possible keypad shortcut bug or docs typo Robert Arkiletian Nov 22, 2020  
 
In the code below. The keypad number 5 requires the addition of the char (in single qoutes) of the number to FL_KP but for the F5 key it requires an integer. This doesn't seem consistent. The 1.3.5 docs under Enumerations specify adding an int not a char. So is this a bug or a typo in the docs? See the test code below. BTW I know a char is interpreted as an int for addition but '5' != 5

#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>

void foo(Fl_Widget* o){
   printf("5 pressed\n");
}

int main() {
 Fl_Window *window = new Fl_Window(200,200,300,300);
 Fl_Button *b = new Fl_Button(0, 0, 130, 40,"keypad 5");
 b->callback(foo);
 b->shortcut(FL_KP+5);   //does not work
 //b->shortcut(FL_KP+'5'); //works when adding char
 //b->shortcut(FL_F+5);    // works when adding an int
 //b->shortcut(FL_F+'5');   //does not work
 window->end();
 window->show();
 return Fl::run();
}

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/ae347ed9-21e9-4d0d-9154-dfc4a209c779n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.