On 14 April 2010 14:49, Michael Schmid <[email protected]> wrote:

> FLTK version: 1.1.9

1.1.10 is current stable...

> I use 'Fl_Input' with 'FL_INPUT_READONLY' set.
> How can I get the character which was really intended to press? With
> event_key() I get only the key pushed on the keyboard (So if I press the
> keys 'Shift & 1' I get '1' by event_key() and not '+' as I wanted (->
> Have a german keyboard)).
> I could decode it in combination with event_state() as far a I
> unterstood, but to be honest I don't want to do this... Is there a
> funktion which can be used to obtain the key intended (For example
> 'Shift & 1' gives '+')? Or has anybody an algorithm which can be used to
> implement this?

I think you can get this from Fl::event_text, which is just a char*.

Now, the docs say that this "Returns the text associated with the
current FL_PASTE or FL_DND_RELEASE event." but I have a bit of code
that does this (below) in its handle() method on regular key strokes
and *seems* to do the Right Thing.

        case FL_KEYBOARD:
                el = Fl::event_length();
                key = Fl::event_key();

                if(el) key_c = Fl::event_text()[0]; // probably a dodgy 
assumption...

Try if that works for you.
Cheers,
-- 
Ian

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

Reply via email to