![]() |
Toolbar button rectangles |
Post Reply
|
| Author | |
Jeff1
Newbie
Joined: 19 August 2005 Status: Offline Points: 8 |
Post Options
Thanks(0)
Quote Reply
Topic: Toolbar button rectanglesPosted: 19 August 2005 at 10:01am |
|
Do you know how to get the rectangle of the toolbar button that is
right clicked on so that a menu can be displayed and aligned with the
bottom left corner of the button?
Something like: get the right click point find the rect of the button that was right clicked on appendmenu items to a menu track the menu and draw it at bottom left of button Thanks. |
|
![]() |
|
Jeff1
Newbie
Joined: 19 August 2005 Status: Offline Points: 8 |
Post Options
Thanks(0)
Quote Reply
Posted: 22 August 2005 at 4:27pm |
|
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{ switch (pMsg->message) { case WM_RBUTTONDOWN: // if right mouse down on a controlbar, display a menu { m_ptButtonRightClick.x=LOWORD(pMsg->lParam); m_ptButtonRightClick.y=HIWORD(pMsg->lParam); CWnd* pWnd = CWnd::FromHandlePermanent(pMsg->hwnd); if (pWnd == NULL) break; CXTPToolBar* pBar = DYNAMIC_DOWNCAST(CXTPToolBar, pWnd); if (pBar == NULL) break; CXTPControl* pControl = pBar->GetControls()->HitTest(m_ptButtonRightClick); if (pControl == NULL) break; CRect rButton; rButton=pControl->GetRect(); pBar->ClientToScreen(&rButton); m_ptButtonRightClick.x=rButton.left; m_ptButtonRightClick.y=rButton.bottom; m_uButtonRightClickID=pControl->GetID(); PostMessage(WM_COMMAND, m_uButtonRightClickID); return TRUE; } break; } return MAINFRAME_BASE::PreTranslateMessage(pMsg); } |
|
![]() |
|
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 |