Ticket #14987 (closed defect: fixed)

Opened 5 months ago

Last modified 5 months ago

wxKeyEvent::GetPosition always returning (-1,-1)

Reported by: tm Owned by:
Priority: normal Milestone:
Component: base Version: 2.9-svn
Keywords: wxKeyEvent Cc:
Blocked By: Patch: yes
Blocking:

Description

Calling wxKeyEvent::GetPosition returns always wxPoint(-1,-1). Using GetX() and GetY() returns the correct mouse position. (wxWidgets from svn, using wxMSW)

How to reproduce: in sample/keyboard/keyboard.cpp, line 489
replace

, event.GetX()
, event.GetY()

with

, event.GetPosition().x
, event.GetPosition().y

When now running the keyboard example, column position contains always (-1,-1)

Probably introduced in changeset 72207.
Possible solution: wxKeyEvent::GetPosition needs to call InitPositionIfNecessary() before returning values.

Attachments

wxkeyevent_position.patch download (1.6 KB) - added by tm 5 months ago.

Change History

Changed 5 months ago by tm

Changed 5 months ago by tm

  • patch set

Added patch with possible solution for this bug.

Changed 5 months ago by VZ

  • status changed from new to closed
  • resolution set to fixed

(In [73411]) Fix wxKeyEvent::GetPosition() after the changes of r72207.

Now that the position of wxKeyEvent is initialized on demand, don't use m_x
and m_y fields directly but always use GetX() and GetY().

Also improve GetPosition() documentation slightly and mention only the new
version, taking wxCoord, in it as the old one, taking long, is provided for
compatiblity only.

Closes #14987.

Note: See TracTickets for help on using tickets.