> I'm trying to create a touchscreen-keyboard on an embedded 
> linux gadget. 
> My guess is that i should be able to generate keyboard events 
> for it to 
> work, but after RTFM i'm still in the dark about how this can 
> be done. 
> Or i might just be wrong and it can be done in another way, 
> but i can't 
> see the forest because of all the trees...
> 
> Any pointers would be greatly appreciated.

Hmmm, this *nearly* works - if you type once on the "real" keyboard,
then my nasty hack to send button pushes to the text widget them seems
to work OK... At least on this winXP box, but I'd hope it is portable
enough.

There's something I'm missing with the keyboard focus or soemthing, but
I can't look at it any more right now: maybe this will get you started.

---------------------
# data file for the Fltk User Interface Designer (fluid)
version 1.0108 
header_name {.h} 
code_name {.cxx}
decl {\#include <stdio.h>} {} 

Function {send_key(char key)} {open return_type void
} {
  code {static char key_string[16];       
printf("%c", key);
fflush(stdout);
key_string[0] = key;
key_string[1] = 0;
Fl::e_text = key_string;
Fl::handle(FL_KEYDOWN, main_win);
Fl::check();
Fl::e_text = key_string;
Fl::handle(FL_KEYUP, main_win);} {}
} 

Function {} {open
} {
  Fl_Window main_win {
    label {key test} open
    xywh {620 415 424 380} type Double visible
  } {
    Fl_Input text_win {
      xywh {10 6 400 203} type Multiline labeltype NO_LABEL
    }
    Fl_Button quit {
      label Quit
      callback {main_win->hide();}
      xywh {350 350 64 25}
    }
    Fl_Button key_A {
      label A
      callback {send_key('A');}
      xywh {20 240 50 40} labelfont 1 labelsize 28
      code0 {o->clear_visible_focus();}
    }
    Fl_Button key_B {
      label B
      callback {send_key('B');}
      xywh {77 240 50 40} labelfont 1 labelsize 28
      code0 {o->clear_visible_focus();}
    }
    Fl_Button key_C {
      label C
      callback {send_key('C');}
      xywh {135 240 50 40} labelfont 1 labelsize 28
      code0 {o->clear_visible_focus();}
    }
    Fl_Button key_D {
      label D
      callback {send_key('D');}
      xywh {192 240 50 40} labelfont 1 labelsize 28
      code0 {o->clear_visible_focus();}
    }
    Fl_Button key_E {
      label E
      callback {send_key('E');}
      xywh {250 240 50 40} labelfont 1 labelsize 28
      code0 {o->clear_visible_focus();}
    }
    Fl_Return_Button rtn {
      callback {send_key('\\n');}
      xywh {335 240 80 45} labeltype NO_LABEL labelsize 20
      code0 {o->clear_visible_focus();}
    }
    Fl_Button space_bar {
      label Space
      callback {send_key(' ');}
      xywh {75 295 170 30}
      code0 {o->clear_visible_focus();}
    }
  }
  code {Fl::focus(text_win);} {selected
  }
} 
---------------------





SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 
3EL
A company registered in England & Wales.  Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to