Page 1 of 1

wxTreeCtrl Drag/Drop with Ctrl key

Posted: Tue Nov 20, 2012 9:10 pm
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.

Re: wxTreeCtrl Drag/Drop with Ctrl key

Posted: Tue Nov 20, 2012 9:42 pm
by doublemax

Re: wxTreeCtrl Drag/Drop with Ctrl key

Posted: Tue Nov 20, 2012 9:44 pm
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

Re: wxTreeCtrl Drag/Drop with Ctrl key

Posted: Wed Nov 21, 2012 2:37 am
by congminh60