Opened 9 years ago

Closed 9 years ago

#14622 closed defect (fixed)

Code sample for wxKeyEvent::GetKeyCode() does not work correctly

Reported by: raananc Owned by:
Priority: normal Milestone:
Component: documentation Version: stable-latest
Keywords: GetUnicodeKey, GetKeyCode Cc:
Blocked By: Blocking:
Patch: no

Description

The code snippet does not work correctly when a Backspace is keyed: event.GetUnicodeKey() returns 8, which is not printable.

Until GetUnicodeKey() is modified to return WXK_NONE for Backspace, the documentation needs to be modified. Suggested correction: replace the line

if ( event.GetUnicodeKey() != WXK_NONE )

by

wxUniChar e = event.GetUnicodeKey();
if ( wxIsprint(e) )

Change History (1)

comment:1 Changed 9 years ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [72420]) Fix example of using GetUnicodeKey() in the documentation.

A Unicode key is not always printable, it can be a control character as well.

Closes #14622.

Note: See TracTickets for help on using tickets.