apparently unmanaged key values in GUI_StoreKeyMsg(int Key, int Pressed)

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • apparently unmanaged key values in GUI_StoreKeyMsg(int Key, int Pressed)

    Dear all,

    for some (misterious to me) reasons
    • GUI_StoreKeyMsg(Key, Pressed)
    does not store the key message in the keyboard buffer for some values of the integer Key.

    In the documentation I read that Key
    "May be any extended ASCII character (between 0x20 and 0xFF) or any predefined emWin character code"
    but this statement is not true according to my experience.

    I am using that function to forward some ui events to the GUI; I have a list of about 30 events, described with an enum; for some values the information forwarding is not accomplished, but if I change those specific event values the information is forwarded.

    It seems as if there were some 'prohibited' values not to be used with GUI_StoreKeyMsg.

    Any idea about this strange behaviour?

    Thanks,
    Ezio
  • Actually the behaviour is not 'regular'; sometimes I see the issue, sometimes I do not but, in order to provide an example, key=52 is a critical value.
    Might it be an issue of buffer overflow?
    I mean, do I have to use some kind of semaphore when using
    • GUI_StoreKeyMsg(Key, Pressed)
    ?

    what happens if I call GUI_StoreKey() before the previous call has been concluded? Do I have to put some kind of instructions like
    • while(GUI_GetKeyMsg())
    before calling
    • GUI_StoreKeyMsg(Key, Pressed)
    ?

    Ezio
  • Hello Ezio,

    Calling the function GUI_StoreKeyMsg() stores the given key in a key buffer. This buffer is read destructively by the Window Manager in order to send according messages to the window which currently has the input focus. Could you please verify the window, which should receive a key message, has the input focus? From the emWin point of view the key code 52 should not be critical.

    Best regards,
    Adrian