Wiki Page Content

Differences between revisions 9 and 10
Revision 9 as of 2013-08-08 21:26:32
Size: 904
Editor: RyanGordon
Comment: Edited
Revision 10 as of 2013-08-14 08:42:21
Size: 2089
Editor: Yttrill
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
Line 10: Line 9:
||Uint32||'''type'''||SDL_TEXTINPUT||
||Uint32||'''windowID'''||The window with keyboard focus, if any||
||char||'''text'''||The null-terminated input text in UTF-8 encoding||
||Uint32 ||'''type''' ||SDL_TEXTINPUT ||
||Uint32 ||'''windowID''' ||The window with keyboard focus, if any ||
||char ||'''text''' ||The null-terminated input text in UTF-8 encoding ||
Line 18: Line 18:
Line 22: Line 21:
'''Detailed explanation''' (by Jiang Jiang <gzjjgod@gmail.com>)

In a typical GUI application, the OS will be responsible for telling
you the candidate text (via SDL_TEXTEDITING), you can choose how (and
where) to show it in your UI.
Let's say with an input method I typed "abc" and got unicode character
"X", the SDL application will first receive three SDL_TEXTEDITING
events with 'a', 'ab' and 'abc', then finally receive SDL_TEXTINPUT
event with unicode character 'X'.
During this text compositing process, user can press any arbitrary
keys such as Function, backspace, both the SDL application and OS
input method will receive it and decide whether to deal with these
keys or not. For instance when user press backspace, most input
methods will delete the last candidate character typed and SDL app
will receive a new SDL_TEXTEDITING event (let's say user typed a, b,
backspace, c, then the application will receive 4 events containing
'a', 'ab', 'a', 'ac' each).
SDL_SetTextInputRect() gives the OS a hint for where to show the
candidate text list, since the OS doesn't know where you want to draw
the text you received via SDL_TEXTEDITING event.



Line 23: Line 46:
 .[[SDL_EventType]]  . [[SDL_EventType]]
Line 26: Line 49:
 .[[SDL_Event]]
 .[[SDL_TextEditingEvent]]
 . [[SDL_Event]]
 . [[SDL_TextEditingEvent]]
Line 30: Line 53:
 .[[SDL_StartTextInput]]
 .[[SDL_StopTextInput]]
 . [[SDL_StartTextInput]]
 . [[SDL_StopTextInput]]
Line 34: Line 57:
[[CategoryStruct]], [[CategoryEvents]] CategoryStruct, CategoryEvents

SDL_TextInputEvent

A structure that contains keyboard text input event information.

Data Fields

Uint32

type

SDL_TEXTINPUT

Uint32

windowID

The window with keyboard focus, if any

char

text

The null-terminated input text in UTF-8 encoding

Code Examples

You can add your code example here

Remarks

SDL_TextInputEvent() is a member of the SDL_Event union and is used when an event of type SDL_TEXTINPUT is reported. You would access it through the event's text field.

Detailed explanation (by Jiang Jiang <gzjjgod@gmail.com>)

In a typical GUI application, the OS will be responsible for telling you the candidate text (via SDL_TEXTEDITING), you can choose how (and where) to show it in your UI. Let's say with an input method I typed "abc" and got unicode character "X", the SDL application will first receive three SDL_TEXTEDITING events with 'a', 'ab' and 'abc', then finally receive SDL_TEXTINPUT event with unicode character 'X'. During this text compositing process, user can press any arbitrary keys such as Function, backspace, both the SDL application and OS input method will receive it and decide whether to deal with these keys or not. For instance when user press backspace, most input methods will delete the last candidate character typed and SDL app will receive a new SDL_TEXTEDITING event (let's say user typed a, b, backspace, c, then the application will receive 4 events containing 'a', 'ab', 'a', 'ac' each). SDL_SetTextInputRect() gives the OS a hint for where to show the candidate text list, since the OS doesn't know where you want to draw the text you received via SDL_TEXTEDITING event.


CategoryStruct, CategoryEvents

None: SDL_TextInputEvent (last edited 2015-01-28 20:41:22 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit