Page 1 of 1

Input of unique characters

Posted: Tue Mar 22, 2016 8:20 am
by desler
Hello everybody
I am having problems parsing unique keys in my program (for example greek letters or cyrillic letters). I am currently using IDCMP_VANILLAKEY to trap input from user, but either I am not parsing the output correctly, or else I need to do something else to get the correct character.
I would be very grateful, if any could point me to the correct path. If I should be so lucky that someone even had a code example, I would be almost ecstatic :) (C or C++).

Thanks you

Re: Input of unique characters

Posted: Wed Mar 23, 2016 12:03 am
by chris
IDCMP_VANILLAKEY is useless for all but the simplest of cases. Try IDCMP_RAWKEY.

Re: Input of unique characters

Posted: Wed Mar 23, 2016 12:09 am
by javierdlr
desler wrote:Hello everybody
I am having problems parsing unique keys in my program (for example greek letters or cyrillic letters). I am currently using IDCMP_VANILLAKEY to trap input from user, but either I am not parsing the output correctly, or else I need to do something else to get the correct character.
I would be very grateful, if any could point me to the correct path. If I should be so lucky that someone even had a code example, I would be almost ecstatic :) (C or C++).

Thanks you
Don't know if it what you' re looking for, but here is and example http://jabirulo.site90.com/temp/TestRawKey.c (not made by me)
Or are you using ReAction objects/classes?

Re: Input of unique characters

Posted: Wed Mar 23, 2016 10:36 pm
by desler
@Jaiverdir
Thanks for the example. I definitely think this is the way to go. However, I am getting a guru the first time I call RawKeyConvert and then garbage from the char container. I know that I most likely am doing something wrong, but I just want to make sure that I don't have to take any special precautions when using C++ instead of C. Also are there any other cases anyone can think of that can cause the guru?

Re: Input of unique characters

Posted: Thu Mar 24, 2016 4:44 pm
by chris
desler wrote:@Jaiverdir
Thanks for the example. I definitely think this is the way to go. However, I am getting a guru the first time I call RawKeyConvert and then garbage from the char container. I know that I most likely am doing something wrong, but I just want to make sure that I don't have to take any special precautions when using C++ instead of C. Also are there any other cases anyone can think of that can cause the guru?
Don't use RawKeyConvert - use MapRawKey().

I didn't know there was a RawKeyconvert, but it looks like it's part of console.device, so you would need to open that device and the interface. Anyway, use MapRawKey, the parameters are the same.