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 » Changing tabs during drag-n-drop Collapse All
Subject Author Date
Suhai Gyorgy Sep 26, 2007 - 6:59 AM

Dear Support,

In our application we need to implement drag-n-drop of some user-defined data. This happens on a dialog on which there is a tabpagecontainer. The user needs to be able to change the tab during dnd. This works great, we used an approach very-very similar to the one you have in your FormEditor sample, in class CFormEditorMdiTabWnd (OnDragOver changes selection, if needed).

Our problem is that we use CExtTabPageContainerOneNoteWnd-derived class. This class draws the tabs different while hovering over them. I’d like to draw the hovering state even during drag-n-drop. CExtTabWnd::OnTabWndMouseTrackingHoverStart seems to be useful, but first: it is a protected method, second: I’m not sure when to call it and its pair, CExtTabWnd::OnTabWndMouseTrackingHoverStop.

Could you please help me implement this feature?
Thank you!
Chris

Technical Support Sep 27, 2007 - 1:25 PM

Please download an updated version of the FormEditor sample with the tab items that become hovered when a toolbox item is being drag-and-dropped over them.

Suhai Gyorgy Sep 28, 2007 - 4:22 AM

It works great, thank you!

Technical Support Sep 26, 2007 - 9:07 AM

If you open several documents in the FormEditor sample and start dragging a tool over MDI tab items, you will notice that a tab becomes selected, when it is covered with the mouse pointer during this operation. This allow you to select any form document when you are dragging a toolbox item. So, here is tab selection that is important while the hover effect is not important at all. Please let us know more details about the tab control behavior inside one note tab page container, you are looking for. Of course it’s possible to repaint tab items so that they correspond to normal or hovered states during drag-n-drop but we need to know what exactly you need? If you want to highlight drop target tab items only, you could code a own tab page container like as follows:

class CYourOneNoteTabControl : public CExtTWPC < CExtTabOneNoteWnd >
{
      . . .
};

class CYourPageContainerWnd : public CExtTabPageContainerOneNoteWnd
{
public:
      virtual CExtTabWnd* OnTabWndGetTabImpl()
      {
            return new CYourOneNoteTabControl;
      }
};
The CYourOneNoteTabControl control should implement the OLE drop target functionality and you can use the CFormEditorMdiTabWnd class from the FormEditor sample as an example. Additionally, the CYourOneNoteTabControl class should implement the CExtTabOneNoteWnd::OnTabWndDrawItem() virtual method so it invokes the parent class method and mark the drop target item as hovered. To mark a tab item as hovered, you should set the CExtTabWnd::m_nHoverTrackingHitTest value equal to the nItemIndex parameter of the OnTabWndDrawItem() virtual method. If you don’t need the standard hovered look of the tab item, you should paint it manually.

Suhai Gyorgy Sep 26, 2007 - 1:13 PM

"So, here is tab selection that is important while the hover effect is not important at all." Yes, I realize that hover effect is not essential in this case, I’d still like to implement it.
"Of course it’s possible to repaint tab items so that they correspond to normal or hovered states during drag-n-drop" This is exactly what I need!

If you could guide me through how to implement this in FormEditor sample, that would be enough for me to do it in my own application.
As the first step, I changed every instance of CExtTabMdiWhidbeyWnd to CExtTabMdiOneNoteWnd in the sample. Now, if I run the sample, I see the hover effect when I’m not doing drag-n-drop, but the hover effect is missing during drag-n-drop.

As the next step, I try to follow your instructions: implement OnTabWndDrawItem virtual method and invoke the parent class method in it. But what did you mean by "mark drop target item as hovered"? How do I know in my OnTabWndDrawItem which tab item my drop target is?

I was thinking I should add some code to OnDragOver but I’m not sure what. I can’t change CExtTabWnd::m_nHoverTrackingHitTest value in CMdiTabOleDropTarget::OnDragOver, because it is a protected variable.

Could you please be a little more specific? Thank you!