![]() |
Context menu for Tabs? |
Post Reply
|
| Author | |
brianh
Groupie
Joined: 30 April 2004 Location: United Kingdom Status: Offline Points: 83 |
Post Options
Thanks(0)
Quote Reply
Topic: Context menu for Tabs?Posted: 21 July 2005 at 10:44am |
|
Is there an easy way to add a context menu for the MDI tabs so that a user can right cick on them and display a menu for the selected tab, specifically I would like a 'close' option? This would also be useful for the tab control too. Thanks. |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 21 July 2005 at 11:19pm |
|
ON_MESSAGE(WM_XTP_PRETRANSLATEMOUSEMSG, OnWorkspaceMouseMsg)
LRESULT CMainFrame::OnWorkspaceMouseMsg(WPARAM wParam,LPARAM lParam) { CPoint point = CPoint((DWORD)lParam); CXTPTabManagerItem* pItem = m_MTIClientWnd.HitTest(point); if (pItem){ if (wParam == WM_RBUTTONDOWN){ CWnd* pFrame = CWnd::FromHandle(pItem->GetHandle()); MDIActivate(pFrame); m_MTIClientWnd.Refresh(); CMenu menuPopup; VERIFY(menuPopup.LoadMenu(IDR_WORKSAPCE_POPUP)); m_MTIClientWnd.WorkspaceToScreen(&point); CXTPCommandBars::TrackPopupMenu(menuPopup.GetSubMenu(0), 0, point.x, point.y, this);
m_MTIClientWnd.Refresh(); return TRUE;} return FALSE; } return FALSE;} |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
brianh
Groupie
Joined: 30 April 2004 Location: United Kingdom Status: Offline Points: 83 |
Post Options
Thanks(0)
Quote Reply
Posted: 25 July 2005 at 8:31am |
|
Thanks Oleg, that's just what I needed. :) I would also like to do the same for the CXTPTabControl tabs, any idea how? Thanks. |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 26 July 2005 at 1:51am |
|
Only to override CXTPTabControl and its PreTranslateMessage BOOL CTabControl2::PreTranslateMessage(MSG* pMsg) // doo something. } return CXTPTabControl ::PreTranslateMessage(pMsg); |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
brianh
Groupie
Joined: 30 April 2004 Location: United Kingdom Status: Offline Points: 83 |
Post Options
Thanks(0)
Quote Reply
Posted: 26 July 2005 at 4:48am |
|
Thanks Oleg, overriding PreTranslateMessage() and using the HitTest() function allows me to identify the tab being clicked, so I should be able to display a tab specific menu. :) Thanks again. |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |