wxGenericTreeCtrl - issue with drag and drop

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.
Simen
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Aug 08, 2018 10:52 am

wxGenericTreeCtrl - issue with drag and drop

Postby Simen » Wed Aug 08, 2018 12:43 pm

Hello guys !

i would like to ask you for help. I am working with wxGenericTreeCtrl (mainly because it is faster than wxTreeCtrl). I am not able to send so much code but i have problems regarding implementation drag and drop functionality.

I am able to implement it with standard wxTreeCtrl and everythink works just fine. When i switch to wxGenericTreeCtrl i am not able to access myDir::OnBeginDrag.

I use this connect to register event.

Code: Select all

Connect(wxID_ANY, wxEVT_COMMAND_TREE_BEGIN_DRAG, wxTreeEventHandler(SceneGraphWindow::OnBeginDrag), (wxObject *)NULL, this);


I also tried drag and drop with file from directly and i moved file into tree and it works fine as well.

I searched forum and found this post which is simillar to my issue:
https://forums.wxwidgets.org/viewtopic.php?t=8732

But i am not able to find:

Code: Select all

wxGenericTreeCtrl::GetTreeCtrl


Does anybody had same issue as mine ?
Last edited by Simen on Thu Aug 09, 2018 5:51 am, edited 1 time in total.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2674
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGenericTreeCtrl - issue with drag and drop

Postby ONEEYEMAN » Wed Aug 08, 2018 2:26 pm

Hi,
wx version?
Platform/toolkit?

Thank you.

Simen
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Aug 08, 2018 10:52 am

Re: wxGenericTreeCtrl - issue with drag and drop

Postby Simen » Thu Aug 09, 2018 5:49 am

Hello,

sorry for not mentioning - I try this with wxWidgets 3.1.0 and 3.1.1 and i am working on Windows 10 with VS express 2015.

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

Re: wxGenericTreeCtrl - issue with drag and drop

Postby doublemax » Thu Aug 09, 2018 7:58 am

Please check the "treectrl" sample that comes with wxWidgets.

In the file "treetest.h" change "#define USE_GENERIC_TREECTRL 0" to "#define USE_GENERIC_TREECTRL 1" and rebuild the sample. Check if drag-and-drop still works with that setting.
Use the source, Luke!

Simen
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Aug 08, 2018 10:52 am

Re: wxGenericTreeCtrl - issue with drag and drop

Postby Simen » Thu Aug 09, 2018 2:19 pm

Thank you so much for idea! I compile sample from wxwigs and i try with wxGenericTree -> it works. So i am trying to fing bug in my code. I am not able to access OnBeginDrag. I can see comment in example:

Code: Select all

void MyTreeCtrl::OnBeginDrag(wxTreeEvent& event)
{
    // need to explicitly allow drag
    if ( event.GetItem() != GetRootItem() )
    {
        m_draggedItem = event.GetItem();


Do you please have any idea how to "explicitly allow drag" as it is mantioned in comment here ?

Simen
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Aug 08, 2018 10:52 am

Re: wxGenericTreeCtrl - issue with drag and drop

Postby Simen » Fri Aug 10, 2018 11:50 am

Hello guys,
little update .. i find out that i am registering event wxEVT_MOTION ... when i am using wxGenericTreeCtrl and when i disable connect to wxEVT_Motion it starts to work ! i will write more info after some diggin.


Return to “C++ Development”

Who is online

Users browsing this forum: No registered users and 8 guests