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 » Handle Right-Click Event for CExtTabPageContainerWnd Collapse All
Subject Author Date
Debabrata Mukherjee Jan 2, 2008 - 9:40 AM

THe CExtTabPageContainerWnd does not repond to

OnTabWndClickedButton(LONG nItemIndex,bool bButtonPressed,INT nMouseButton,UINT nMouseEventFlags).

Please let me know what can be done. Please treat it urgently.

Technical Support Jan 3, 2008 - 4:25 AM

The nItemIndex in OnTabWndClickedButton() is a zero-based index of the clicked tab item. The nMouseButton is set to VK_RBUTTON if the click was made with the right button. Please note OnTabWndClickedButton() is invoked twice: when you press a mouse button (bButtonPressed == true) and when your release it (bButtonPressed == false).

Suhai Gyorgy Jan 3, 2008 - 4:43 AM

This doesn’t seem to be true. CExtTabPageContainerWnd::OnTabWndClickedButton() method is called when any of the tabstrip buttons are clicked on (Close, Help, Home button, etc.)

On the other hand, CExtTabWnd::OnTabWndClickedItem() method is called when any of the tab items are clicked on (as mentioned in Support’s answer).

But I couldn’t find any overridable method which is called when the user right-clicks on the empty area of the tabstrip (no item, no button).
Actually, CExtTabWnd::OnTabWndMouseTrackingPushedStop() method seems to be called, but you can’t test which mouse button was clicked ( and this method doesn’t seem to be the right one to use in this case )

Probably CExtTabWnd::_ProcessMouseClick should be overriden and tested for the proper parameters.

Debabrata Mukherjee Jan 3, 2008 - 9:19 AM

Hi,

But the tab pages in my CExtTabPageContainerWnd donot have a close,hide buttons etc.
when I do a left click, it is well handled by the method ->OnTabWndSelectionChange(). However, I want to display a menu and do something with the right click as well. Can you please suggetst whats the workaround.

Debabrata Mukherjee Jan 3, 2008 - 9:28 AM

One more thing is whether I left clcik the tab page or right click on it, the OnTabWndSelectionChnage() gets called.

Suhai Gyorgy Jan 4, 2008 - 4:22 AM

Sorry, little mistake:

class CMyTabPageContainerWndOneNote : public CExtTabPageContainerOneNoteWnd
{
	class CMyTabWndOneNote : public CExtTabOneNoteWnd
	{
		virtual bool OnTabWndClickedItem(
			LONG nItemIndex,
			bool bButtonPressed,
			INT nMouseButton, // MK_... values
			UINT nMouseEventFlags
			)
		{
			bool bRet = CExtTabOneNoteWnd::OnTabWndClickedItem(
				nItemIndex,
				bButtonPressed,
				nMouseButton,
				nMouseEventFlags
				);
			if ( bButtonPressed && nMouseButton == MK_RBUTTON )
			{
				// same as WM_RBUTTONDOWN
				// show menu here
			}
			return bRet;
		}
	}; // class CMyTabWndOneNote	
	virtual CExtTabWnd * OnTabWndGetTabImpl()
	{
		return new CExtTWPC < CMyTabWndOneNote >;
	}
}; // class CMyTabPageContainerWndOneNote

Suhai Gyorgy Jan 4, 2008 - 4:19 AM

You can use this class ( it is derived from OneNote type of tab, you can substitute that to any other type ):

class CMyTabPageContainerWndOneNote : public CExtTabPageContainerOneNoteWnd
{
	class CMyTabWndOneNote : public CExtTabOneNoteWnd
	{
		virtual bool OnTabWndClickedItem(
			LONG nItemIndex,
			bool bButtonPressed,
			INT nMouseButton, // MK_... values
			UINT nMouseEventFlags
			)
		{
			if ( bButtonPressed && nMouseButton == MK_RBUTTON )
			{
				// same as WM_RBUTTONDOWN
				// show menu here
			}
		}
	}; // class CMyTabWndOneNote	
	virtual CExtTabWnd * OnTabWndGetTabImpl()
	{
		return new CExtTWPC < CMyTabWndOneNote >;
	}
}; // class CMyTabPageContainerWndOneNote
Please keep in mind that this work only if you right-click over any of the tab items.