Jump to content



Photo
- - - - -

Bkey_Getkeywait() Multiple Keys Down


  • Please log in to reply
3 replies to this topic

#1 Mrfence97

Mrfence97

    Newbie

  • Members
  • Pip
  • 2 posts

  • Calculators:
    FX-9860GII

Posted 25 December 2013 - 08:08 PM

Using the CASIO FX-9860 SDK, I am using the "BKey_GetKeyWait()" function to obtain key press information (as that PDF recommends), using the function below:

char KeyDownC(int code1, int code2)
{ 
unsigned int key1 = 0, key2 = 0; 
short unused = 0;
if(Bkey_GetKeyWait(&key1, &key2, KEYWAIT_HALTOFF_TIMEROFF, 0, 0, &unused) == KEYREP_KEYEVENT)
{
    if(key1==code1 && key2==code2) 
        return 1;
    else
        return 0;
}
}

However, when running an Add-In program either in the emulator or actually on my calculator (the FX-9860GII), the function only returns the "first" key pressed, even if other keys are pressed after it, while the original is still held down. Therefore for it to actually register a key change, all keys must be released before pressing the new key. This is not the behavior I want, and I believe it is a change from the original "IsKeyDown()" function which would allow multiple keys to be pressed and returned TRUE for all of them. However, it has been depreciated and seemingly removed from the 9860GII.

I can obtain the multiple key down behavior in the emulator by using the revolution-fx function "FastKeyDown()"; however, this crashes the app on the actual calculator, probably because of the various OS changes between the 9860G and the 9860GII. Attempting to use "IsKeyDown()", again, works fine in the emulator, but crashes the app on the actual calculator, most likely because it has been removed!

Therefore, does anyone know how to obtain the multiple keys down behavior described above on the 9860GII, either by somehow using "BKey_GetKeyWait()" function, possibly "GetKey()" (although that seems to hang until a key is actually pressed), or even by re-writing the assembly for the "FastKeyDown()" to make it work on the 9860GII?

Many Thanks.

#2 Casimo

Casimo

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 641 posts
  • Gender:Not Telling

Posted 29 December 2013 - 09:50 AM

You should use PRGM_GetKey along with a system call. A post that could help you is somewhere here in the forum, but I don't have the link now. It is be somewhere in the section important or so.

#3 Mrfence97

Mrfence97

    Newbie

  • Members
  • Pip
  • 2 posts

  • Calculators:
    FX-9860GII

Posted 31 December 2013 - 02:04 PM

Thanks Casimo, that worked exactly as I hoped! If anyone is interested in the link mentioned, it is here: http://community.cas...lopment-thread/

On the same page, you also linked to an updated version of revolution-fx but the link is now dead; any chance of a re-upload?

#4 flyingfisch

flyingfisch

    Casio Maniac

  • Deputy
  • PipPipPipPipPipPipPipPip
  • 1891 posts
  • Gender:Male
  • Location:OH,USA
  • Interests:Aviation, Skiing, Programming, Mountain Biking.

  • Calculators:
    fx-9860GII
    fx-CG10 PRIZM

Posted 05 January 2014 - 02:34 AM

Is this what you're looking for? http://sourceforge.n...ution-fx/files/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users