Ticket #4448 (closed defect: fixed)

Opened 3 years ago

Last modified 18 months ago

wxTR_MULTIPLE breaks EVT_LEFT_DOWN on MS Windows

Reported by: bdimm Owned by:
Priority: high Milestone:
Component: wxMSW Version:
Keywords: wxTR_MULTIPLE, EVT_LEFT_DOWN Cc: bdimm, wx@…, wxscary@…, net147@…
Blocked By: Patch: no
Blocking:

Description

On Microsoft Windows, if you create a wxTextCtrl with style wxTR_MULTIPLE, left mouse button down events (EVT_LEFT_DOWN) are not triggered correctly. Specifically, you will only get an EVT_LEFT_DOWN if you click on a tree item that is already selected (either by a previous click or by moving the selection with the cursor keys). If you click on a tree item that is not selected, no EVT_LEFT_DOWN occurs. You will, however, get the EVT_LEFT_UP event. This does not occur on Linux/GTK, or when wxTR_MULTIPLE is not used.

I've attached a sample program. It just displays a little tree and displays a wxMessageBox on a EVT_LEFT_DOWN or EVT_LEFT_UP. On Windows, you'll find that you get a "Left Up" without any preceeding "Left Down" when you click on an item that is not already selected.

Attachments

treectrl_bug.cpp download (1.2 KB) - added by bdimm 3 years ago.
Creates a small tree and should display "Left Down" message when left-clicked.

Change History

Changed 3 years ago by bdimm

Creates a small tree and should display "Left Down" message when left-clicked.

follow-up: ↓ 3   Changed 2 years ago by mspacek

  • cc wx@… added
  • keywords wxTR_MULTIPLE, EVT_LEFT_DOWN added
  • status changed from new to confirmed

I can confirm this behaviour in wxPython 2.8.8.0 (unicode), Python 2.5.2, WinXP SP3
I think bdimm meant to write wxTreeCtrl instead of wxTextCtrl in the original description.
This smells like it's related to the EVT_TREE_SEL_CHANGED event problems reported in #626 and #2307

  Changed 2 years ago by mspacek

  • priority changed from normal to high

I've also found seemingly related behaviour with keyboard events, again in a wxTreeCtrl with the wxTR_MULTIPLE flag set, again in wxPython 2.8.8.0 (unicode), Python 2.5.2, WinXP SP3:

Neither wxEVT_TREE_KEY_DOWN nor wxEVT_KEY_DOWN events are fired when the space bar is pressed. However, a wxEVT_KEY_UP event is fired when the space bar is released. The space bar is important as it can be used together with CTRL to select/deselect the currently focused tree item. Handling the keyboard events directly seems necessary as a workaround for the wxEVT_TREE_SEL_CHANGED bug (#626 and #2307). I can't find any other key that only fires an up event in this situation - all others seem to fire both down and up events (except maybe TAB, which traverses to the next widget in my app).

However, when the wxTR_MULTIPLE flag is not set, the space bar does indeed trigger a wxEVT_TREE_KEY_DOWN or wxEVT_KEY_DOWN event.

in reply to: ↑ 1   Changed 2 years ago by bdimm

Replying to mspacek:

I think bdimm meant to write wxTreeCtrl instead of wxTextCtrl in the original description.

Correct, I meant wxTreeCtrl. Sorry about that.

  Changed 22 months ago by Scary

  • cc wxscary@… added

  Changed 21 months ago by net147

  • cc net147@… added

  Changed 18 months ago by net147

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

#626 was resolved which fixes this issue.

Note: See TracTickets for help on using tickets.