In many scenarios, the event of left clicking on a tree item is required. This modification:
Defined the wxEVT_TREE_ITEM_LEFT_CLICK event;
Added a few lines of code in the mouse event handler to issue a wxEVT_TREE_ITEM_LEFT_CLICK event for the situation where the previous left button press and the current left button release result in the same item for both events.
https://github.com/wxWidgets/wxWidgets/pull/26432
(8 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@vadz commented on this pull request.
Thanks, this looks good but I don't understand why does the generic version send the event asynchronously, could you please explain or change this?
And also the documentation should be improved a bit more.
TIA!
> + wxTreeEvent* pEvent = new wxTreeEvent(wxEVT_TREE_ITEM_LEFT_CLICK, this, m_underMouse); + GetEventHandler()->QueueEvent(pEvent);
Why do you do it like this instead of just calling ProcessWindowEvent()?
> @@ -3593,6 +3595,23 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
if (m_underMouse)
RefreshLine( m_underMouse );
}
+ if (event.LeftDown())
+ {
+ m_isLastMouseEventLeftDown = true;
+ }
+ else
+ {
+ if (event.LeftUp() && m_isLastMouseEventLeftDown)
+ {
+ m_isLastMouseEventLeftDown = false;
Minor, but this could/should be done just right after else above instead of being done twice, here and below.
In .gitignore:
> @@ -457,3 +457,4 @@ /build/cmake/output/ CMakeUserPresets.json +/.vs
Sorry, this is unrelated to this PR, please remove it.
> @@ -142,6 +142,9 @@
@event{EVT_TREE_ITEM_EXPANDING(id, func)}
The item is being expanded. This can be prevented by calling Veto().
Processes a @c wxEVT_TREE_ITEM_EXPANDING event type.
+ @event{EVT_TREE_ITEM_LEFT_CLICK(id, func)}
+ The user has clicked the item with the left mouse button.
+ Processes a @c wxEVT_TREE_ITEM_LEFT_CLICK event type.
Could you please add this:
⬇️ Suggested change- Processes a @c wxEVT_TREE_ITEM_LEFT_CLICK event type. + Processes a @c wxEVT_TREE_ITEM_LEFT_CLICK event type. + This even is available since wxWidgets 3.3.3.
> @@ -142,6 +142,9 @@
@event{EVT_TREE_ITEM_EXPANDING(id, func)}
The item is being expanded. This can be prevented by calling Veto().
Processes a @c wxEVT_TREE_ITEM_EXPANDING event type.
+ @event{EVT_TREE_ITEM_LEFT_CLICK(id, func)}
Please also add this in other places where other events are documented in this file, search for e.g. EVT_TREE_ITEM_EXPANDING to find them.
> @@ -142,6 +142,9 @@
@event{EVT_TREE_ITEM_EXPANDING(id, func)}
The item is being expanded. This can be prevented by calling Veto().
Processes a @c wxEVT_TREE_ITEM_EXPANDING event type.
+ @event{EVT_TREE_ITEM_LEFT_CLICK(id, func)}
+ The user has clicked the item with the left mouse button.
I think it would be also useful to mention that the item is always valid for the events of this type.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()