![]() |
|
IWEdit OnAsyncKeyPress and OnAsyncKeyUp/Down - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: IWEdit OnAsyncKeyPress and OnAsyncKeyUp/Down (/thread-2430.html) |
IWEdit OnAsyncKeyPress and OnAsyncKeyUp/Down - PaulWeem - 06-10-2021 Hi, In IWEdit OnAsyncKeyPress, the value in "EventParams.Values['which']" differs from the value in OnAsyncKeyUp/Down. It looks like another or extended characterset is being used. My problem is, that in OnAsyncKeyPress keys like <Backspace> or <Delete> do not trigger this event. Is this by design, or is this a glitch? Kind regards, Paul RE: IWEdit OnAsyncKeyPress and OnAsyncKeyUp/Down - Alexandre Machado - 06-14-2021 KeyPress event is only triggered by printable characters (this is part of the DOM specification), so several keys (including Backspace and delete) won't trigger this event. I suggest you try OnAsyncKeyDown event which will work correctly. using EventParams.Values['which'] you will get: Backspace: 8 Delete: 46 RE: IWEdit OnAsyncKeyPress and OnAsyncKeyUp/Down - PaulWeem - 06-14-2021 Hi Alexandre, I can cope with the fact that KeyPress is only triggered by printable characters. But when I check EventParams.Values['which'] in OnAsyncKeyDown, I get a different value then the key pressed. For example, in OnAsyncKeyDown (and OnAsyncKeyUp), when I press -, the values I get are: which: 189 char: ½ ansichar: ½ But when I check the same in OnAsyncKeyPress, I get the values: which: 45 char: - ansichar: - RE: IWEdit OnAsyncKeyPress and OnAsyncKeyUp/Down - PaulWeem - 06-23-2021 (06-14-2021, 08:51 AM)PaulWeem Wrote: Hi Alexandre, Hi Aleandre, Did you have time to look into this? Kind regards, Paul RE: IWEdit OnAsyncKeyPress and OnAsyncKeyUp/Down - PaulWeem - 07-08-2021 (06-23-2021, 11:49 AM)PaulWeem Wrote:(06-14-2021, 08:51 AM)PaulWeem Wrote: Hi Alexandre, ? RE: IWEdit OnAsyncKeyPress and OnAsyncKeyUp/Down - Alexandre Machado - 07-09-2021 Hi Paul, maybe I didn't explain it clearly... I didn't say that you should replace all your OnKeyPress events with OnKeyDown events for all your requirements. They are different events and they behave differently. More importantly: *The keydown and keyup events provide a code indicating which key is pressed, while keypress indicates which character was entered* Please have a look at the spec: https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event So, don't expect OnKeyDown/Up and OnKeyPress events to receive the same parameters when they are triggered. They won't. |