wxTreeCtrl Drag/Drop with Ctrl key Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
congminh60
Knows some wx things
Knows some wx things
Posts: 39
Joined: Sun Oct 10, 2010 1:02 am

wxTreeCtrl Drag/Drop with Ctrl key

Post by congminh60 »

Hi all,

I have a project using the tree control, which tree items are drag and drop ok. My issue is, I cannot read the key state (Ctrl key) to make decision of moving or copying items.

EVT_TREE_SEL_CHANGED(wxID_ANY, SecsHostFrame::OnTreeCommandItemChanged)
EVT_TREE_ITEM_RIGHT_CLICK(wxID_ANY, SecsHostFrame::OnTreeCommandRightButton)
EVT_TREE_BEGIN_DRAG(wxID_ANY, SecsHostFrame::OnTreeCommandBeginDrag)
EVT_TREE_END_DRAG(wxID_ANY, SecsHostFrame::OnTreeCommandEndDrag)
EVT_TREE_KEY_DOWN(wxID_ANY, SecsHostFrame::OnTreeCommandKeyDown)

I already tried to read key state from the (wxTreeEvent &e) inside the SecsHostFrame::OnTreeCommandEndDrag function. But it does not work.

Is there any one have the same issue with me?

Thankyou.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxTreeCtrl Drag/Drop with Ctrl key

Post by doublemax »

Use the source, Luke!
AUser
Knows some wx things
Knows some wx things
Posts: 38
Joined: Mon Jun 26, 2006 12:18 am

Re: wxTreeCtrl Drag/Drop with Ctrl key

Post by AUser »

In my code, I use wxMouseState to get the mouse state (mstate), during a tree end drag event, then use mstate.CmdDown().

Its possible I had this issue once upon a time, but I cannot recall - it seems odd for me to have reached out for mousestate when everywhere else I use the event. Anyway the above works on GTK, mac and windows, at least for me
congminh60
Knows some wx things
Knows some wx things
Posts: 39
Joined: Sun Oct 10, 2010 1:02 am

Re: wxTreeCtrl Drag/Drop with Ctrl key

Post by congminh60 »

Post Reply