XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently 2017年 Oct 22日 07:36

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2015年 Jul 22日 22:28 
Offline
User avatar

Joined: 2013年 Mar 8日 22:27
Posts: 357
BUG : OnKeyDown Event fires incorrectly
Version : 1.9.3.1022
Operating System : Windows 7 Ultimate x86 6.1.7601 (With Service Pack 1)

Description
------------------
On every key down event, `OnKeyDown` event fires twice once with either `Key` or `KeyChar` being 0.

# Expected behavior
On key press, OnKeyDown event should fire with `Key` set to key code (VK_ENTER (13) for enter key etc.) and `KeyChar` set to the key character, if the pressed key is an alphanumeric key.

# Observed behavior
On key press, OnKeyDownEvent fires twice, once with `Key` set to key code and `KeyChar` being 0. It is then followed by another OnKeyDown event, with `Key` set to 0 and `KeyCode` set if available else 0.

# Remarks
This behavior makes it impossible to associate the key code to the character that was typed in

How to reproduce
------------------
Attach an event handler to a focusable control (edit,button or anything set to Can Focused) with the following code:

function edit1OnKeyDown(Sender,Key,KeyChar,Shift)
{
print(Key + " : "+ KeyChar);
}

A test widget with this code is attached herewith.
Typing a b c d e f g h`shift + x` `backspace` will give an output similar to what has been shown in the logs.

These were typed with the CAPS LOCK being OFF

Expected output:
CHARACTER KEY CODE KEY CHAR
--------- -------- --------
A 65 97
B 66 98
C 67 99
D 68 100
E 69 101
F 70 102
G 71 103
H 72 104

`Shift` 16 0

X 88 88 (with Shift); 120 (without)

`Backspace` 8 8


Observed Output:
------------------
[20:24:22 031]: Mouse Leave Widget Window (OnLeave)
[20:24:17 039]: print: 0 : 8
[20:24:17 023]: print: 8 : 0
[20:24:13 061]: print: 0 : 88
[20:24:13 045]: print: 88 : 0
[20:24:12 889]: print: 16 : 0
[20:24:12 250]: print: 0 : 104
[20:24:12 250]: print: 72 : 0
[20:24:11 626]: print: 0 : 103
[20:24:11 626]: print: 71 : 0
[20:24:11 298]: print: 0 : 102
[20:24:11 282]: print: 70 : 0
[20:24:11 033]: print: 0 : 101
[20:24:11 017]: print: 69 : 0
[20:24:10 783]: print: 0 : 100
[20:24:10 783]: print: 68 : 0
[20:24:10 487]: print: 0 : 99
[20:24:10 487]: print: 67 : 0
[20:24:10 112]: print: 0 : 98
[20:24:10 112]: print: 66 : 0
[20:24:09 410]: print: 0 : 97
[20:24:09 395]: print: 65 : 0
[20:24:07 445]: Mouse Enter Widget Window (OnEnter)


Attachments:
chimes_search.xwp [9.56 KiB]
Downloaded 89 times

_________________
Life is a myriad game... Just play it!
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group