On 19.07.2012, at 08:33, kaixuan306 wrote: > hello,everyone. > Now I am using fltk 1.3.0 and nano-x,nxlib to develop program to work on > ep9315 arm linux system. I have solve the problem about the font. Now I > commit a new difficulty: > (1): there are many keys(array) on my ep9315 board, now I detect the key push > by query in add_timeout's callback funtion. I fint that in fltk there are key > event, my problem is how to use the key event to detect the key push. my > key's ascall code is the same as PC. > (2):when I push one key such as "1", I want to display some widgets, when > push another key such as "2", to display another group of widgets, > now I build some groups of widgets by Fl_Group, such as group1 and group2, > push key"1", to display group1 and push key"2", to display group2.But it > seems that the LCD screen of EP9315 update is a little slow. Is there any > good idea to realize this?
Using a timer is not efficient at all. Instead, use either the handler for urecognized events: http://www.fltk.org/doc-1.3/group__fl__events.html#gae2d39bda7362e444afa41166c478b904 This handler is called after all other handlers were tried. If no widget is interested in the keystroke, it should end up here. OR: use the first event handler of them all: event_dispatch http://www.fltk.org/doc-1.3/group__fl__events.html#gafc8bd62d8fdacef87c56ed3a22cdcebc This handler receives events *before* any widget does. If you use '1' and '2' as keys, no other widget will ever receive a '1' or '2' keystroke. OR : this is probably the best solution: derive your own class from Fl_Window and write a new handle(int) function. http://www.fltk.org/doc-1.3/classFl__Window.html#a9c0eb1c55a1a62ef3d3d87676f936187 - Matthias _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk