Узнайте символьную нажатую клавишу

Чтобы исправить ваш код, оно должно быть:

C = mat2cell(A,2*ones(2562,1));

И чтобы преобразовать A в трехмерную матрицу срезов 2x2, вы можете использовать:

C = permute(reshape(A.',2,2,[]), [2,1,3]);
7
задан Andres 14 April 2009 в 18:54
поделиться

3 ответа

Вы пропустили довольно важную часть цитаты или ее не было в том месте, где вы ее нашли:

Например , если вы нажмете Shift + 3, Метод getASCIICode () возвращает # в Японская клавиатура, как и на английская клавиатура.

http://livedocs.adobe.com/flex/201/langref/flash/events/KeyboardEvent.html

Это, вероятно, более полезно:

Свойство charCode представляет собой числовое значение этот ключ в текущем наборе символов (набор символов по умолчанию - UTF-8, который поддерживает ASCII).

http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp .htm? context = LiveDocs_Parts & file = 00000480.html

Ваше приложение определяет, какой набор символов используется, а это означает, что даже если вам придется использовать отдельные клавиши разных локальных клавиш клавиатуры для создания одного и того же символа, он будет иметь один и тот же код charCode.

2
ответ дан 7 December 2019 в 14:37
поделиться

NOTE: (This is about keyboard messages in general and does not apply to actionscript alone. I misread the question and provided a deeper answer then was helpful)

Really, the path from keyboard to windows char is a VERY complex one, it goes something like this:

  • Keyboard send scancode to Keyboard device driver (KDD).
  • KDD sends a message to the system message queue.
  • The system then sends the message to the foreground thread that created the window with the current keyboard focus.
  • The thread's message loop picks up the message and figures out the correct character translation.

The 'real' char that was typed is not calculated until it finishes that whole process, as each window and thread can be on a different locale and you can't really 'translate' the key without knowing the locale and key buffer history.

The "WM_KEYDOWN" and "WM_KEYUP" messages cannot just be converted with MapVirtualKey or something because you don't know how many key presses make up a single char. The simple method is just handle the 'WM_CHAR' event and use that. Consider the following:

  • en-US locale, you press the following keys a + ' + a, you get the following output "a'a"
  • pt-BZ locale, you press the following keys a + ' + a, you get the following output "aá"

So in both examples you would get 3 KEYDOWN, KEYUP messages, but in the first you get 3 WM_CHAR and in the second you only get 2.

The following article is really good for the basic concepts: http://msdn.microsoft.com/en-us/library/ms646267(VS.85).aspx

1
ответ дан 7 December 2019 в 14:37
поделиться

Для ввода японских символов хирагана и т. Д. Часто требуется несколько нажатий клавиш, а иногда даже выбор соответствующего символа из выпадающего меню. Возможно, вы хотите прослушать другое событие, например, событие изменения текстового поля.

0
ответ дан 7 December 2019 в 14:37
поделиться
Другие вопросы по тегам:

Похожие вопросы: