Left/Right Mouse Click notification on ReportCntrl |
Post Reply |
Author | |
poiser
Newbie Joined: 23 October 2007 Status: Offline Points: 8 |
Post Options
Thanks(0)
Posted: 23 March 2009 at 11:29am |
Currenty I only get a Left/Right ButtonClick notification when a report item is clicked using this code:
ON_NOTIFY( NM_RCLICK, XTP_ID_REPORT_CONTROL, OnReportItemRClick) How can I get mouse event notifications if any area on the report control is clicked (i.e not just report records/items). Example: A report with only one record has a lot of empty space. Right-clicking on this empty space does not generate a mouse event. How can I get it to do so. Why is is that mouse events (left/right button click) are generated only when you right-click an item? |
|
SMaton
Groupie Joined: 04 May 2009 Status: Offline Points: 12 |
Post Options
Thanks(0)
|
Hi,
is there a solution to this? I'm currently looking into this, too, but I haven't found a solution yet. Thanks, Stefan |
|
Bart6
Groupie Joined: 22 March 2009 Location: Belgium Status: Offline Points: 20 |
Post Options
Thanks(0)
|
Hi all,
Same here. i'm looking for the behaviour i get with XTP_NM_REPORT_LBUTTONDOWN, but then for the right mouse button. Bart |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
ON_WM_CONTEXTMENU()?
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Bart6
Groupie Joined: 22 March 2009 Location: Belgium Status: Offline Points: 20 |
Post Options
Thanks(0)
|
No, ON_WM_CONTEXTMENU would work on the Dialog, not the ReportControl. We need a notification message of the right mouse button; but which one? (The ReportControl header file only mentions LBUTTONDOWN)
|
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Not true.
You derive from CXTPReportControl and add a handler for WM_CONTEXTMENU.
void CReportControlEx::OnContextMenu(CWnd* pWnd, CPoint pos)
{ BOOL menuHandled = FALSE; CPoint clientPos = pos; ScreenToClient(&clientPos); CXTPReportColumn *pColumn = GetReportHeader()->HitTest(clientPos); if (pColumn) menuHandled = ShowHeaderMenu(pColumn, pos); else if (HitTest(clientPos)) menuHandled = ShowItemMenu(pos); if (!menuHandled) CXTPReportControl::OnContextMenu(pWnd, pos); } |
|
PokerMemento - http://www.pokermemento.com/
|
|
Bart6
Groupie Joined: 22 March 2009 Location: Belgium Status: Offline Points: 20 |
Post Options
Thanks(0)
|
I was assuming not deriving from ReportCntrl - but you are correct, it does work when deriving. Thanks for the reaction.
->Would be nice if it would work without deriving OOTB. Codejock? Bart |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
Have to agree here. All this hit-testing should live inside the framework!
|
|
PokerMemento - http://www.pokermemento.com/
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
ON_NOTIFY(NM_CLICK, XTP_ID_REPORT_CONTROL, OnReportItemClick) works for any left or both (left + right) button click. e.g.void CVirtualListView::OnReportItemClick(NMHDR * pNotifyStruct, LRESULT * /*result*/) {CXTPReportControl& wndReport = GetReportCtrl(); XTP_NM_REPORTRECORDITEM* pItemNotify = (XTP_NM_REPORTRECORDITEM*) pNotifyStruct; if (!pItemNotify->pColumn) return; if (!pItemNotify->pRow){//do smth with columns - e.g. organize special sort
} } else if (m_bAllowDelete && GetAsyncKeyState(VK_RBUTTON) > 0){ if (AfxMessageBox(_T("Do you want to delete this record?"), MB_YESNO) == IDYES){ //I use it to delete record if both button used
int ind = pItemNotify->pRow->GetIndex();
CDBVListSet* pSet = &GetDocument()->m_dBVListSet; int nRecordCount = pSet->GetRecordCount();pSet->MoveFirst(); pSet->Move(ind); pSet->Delete(); GetReportCtrl().SetVirtualMode( new CVirtualRecord(pSet), nRecordCount - 1, 7);GetReportCtrl().Populate(); } } //if (!pItemNotify->pRow) // return; //TRACE(_T("Click on row %d, col %d\n"), // pItemNotify->pRow->GetIndex(), pItemNotify->pColumn->GetItemIndex());} |
|
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 |