Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » OnGbwDataDndDo Collapse All
Subject Author Date
Suhai Gyorgy Jul 26, 2006 - 9:21 AM

Dear Support,

I’m trying to do drag-n-drop in my grid. As I read in General Forum, I have to override the OnGbwDataDndDo method, so I did just that. But since that method never got called, I realized that I also have to override OnGbwDataDndIsAllowed() and return true in it, instead of original return value, which is false. Still OnGbwDataDndDo doesn’t get called. I even tried to override OnGbwDataDndCanStart and return true in that one as well, but still no luck. I checked all grid and cell styles which could affect Dnd, but all DND styles affect dragging of only header (outer) cells.

What am I missing?

Thank you:
Chris.

Technical Support Jul 26, 2006 - 10:08 AM

The availabilty of drag-and-drop for data cells is controlled by the following method of the CExtGridBaseWnd class:

    virtual bool OnGbwDataDndIsAllowed() const;
So override this method and return true. This is enough to see how the following methods of the same class are working:
    virtual CPoint OnGbwDataDndGetStartOffset() const;
    virtual bool OnGbwDataDndCanStart(
        const CExtGridHitTestInfo & htInfo
        );
    virtual void OnGbwDataDndDo(
        const CExtGridHitTestInfo & htInfo
        );

Suhai Gyorgy Jul 26, 2006 - 11:13 AM

As I wrote in my first message, I did override OnGbwDataDndIsAllowed() method and wrote return true in it. I put a breakpoint in the first line of the OnGbwDataDndDo method, but it never stopped there, so OnGbwDataDndDo never gets called. So my question is, why OnGbwDataDndDo doesn’t get called?

Regards:
Chris.

Technical Support Jul 27, 2006 - 9:15 AM

We added the following to the declaration of CDemoGrid in the SimpleGrids sample:

    virtual bool OnGbwDataDndIsAllowed() const
    {
        return true;
    }
    virtual void OnGbwDataDndDo(
        const CExtGridHitTestInfo & htInfo
        )
    {
        htInfo;
        ::AfxMessageBox( _T("OnGbwDataDndDo") );
    }
The message box pop ups when we start dragging selected data cells in any grid in the SimpleGrids sample. Please check whether the method declarations are exactly the same in your project. Additionally, the drag-and-drop for data will not be available if the selection is not allowed at all.


Suhai Gyorgy Jul 27, 2006 - 12:01 PM

The problem was first caused by the Prof-UIS help. I copy/pasted declaration of OnGbwDataDndDo from there and there it looks like this:

virtual void OnGbwDataDndDo(const CExtGridHitTestInfo htInfo );

I didn’t pay enough attention to your first message, didn’t see missing & from before parameter. Sorry, my bad. It works great now, thank you!

Best regards:
Chris.

Technical Support Jul 27, 2006 - 12:26 PM

We are really sorry. That is our fault. We fixed this in the help.