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 General Discussion » ReportGrid: Expand Button Callback Collapse All
Subject Author Date
Martin Baumgaertner Jul 25, 2007 - 8:14 AM

Hello,

in my CExtReportGridWnd derived class I have overridden OnGbwAnalyzeCellMouseClickEvent. If the extracted HTREEITEM has no children, a left mouse button double-click extracts column/row contents, else the item’s expanded state is toggled.

In addition to this, how can I achieve the same expanded state toggle by single clicking the expand button (plus/minus-signed) while having overridden the above function, just to reach the default behaviour?

Martin

Martin Baumgaertner Jul 26, 2007 - 5:50 AM

Thank you very much for helping me! Now everything works like it should.

Martin

Martin Baumgaertner Jul 26, 2007 - 2:13 AM

Sorry, the rest of the story was missing while pressing "Enter" :-)

So, once again:

// --------------------------
// Declaration
// --------------------------

class CMyReportGridWnd : public CExtPPVW < CExtReportGridWnd >
{
public:
   DECLARE_SERIAL( CMyReportGridWnd );
...
protected:
 	virtual bool OnGbwAnalyzeCellMouseClickEvent ( UINT nChar, UINT nRepCnt, // Prof-UIS overridable
 												   UINT nFlags, CPoint point );
...
};


// --------------------------
// Implementation
// --------------------------

IMPLEMENT_SERIAL( CMyReportGridWnd, CExtReportGridWnd, VERSIONABLE_SCHEMA|1 );
...
bool CMyReportGridWnd::OnGbwAnalyzeCellMouseClickEvent(
    UINT nChar,
    UINT nRepCnt,
    UINT nFlags,
    CPoint point )
{
	ASSERT_VALID( this );
	bool b_ClickEventHandled = CExtGridBaseWnd::OnGbwAnalyzeCellMouseClickEvent( nChar, nRepCnt, nFlags, point );
	if ( b_ClickEventHandled )
	{
		AfxMessageBox("Event Handled");
		return true;
	}
	else
	{
		AfxMessageBox("Event NOT Handled");
		// ...
		// Handle specific mouse click events
		// ...
	}
}


This always ends up with "Event NOT Handled", even when clicking on the expand box. What is wrong?

Martin

Suhai Gyorgy Jul 26, 2007 - 3:20 AM

Sorry, maybe even safer to use:

bool b_ClickEventHandled = CExtPPVW < CExtReportGridWnd >::OnGbwAnalyzeCellMouseClickEvent( nChar, nRepCnt, nFlags, point );

Suhai Gyorgy Jul 26, 2007 - 3:19 AM

The problem is that you are using wrong baseclass. It should be:

bool b_ClickEventHandled = CExtReportGridWnd::OnGbwAnalyzeCellMouseClickEvent( nChar, nRepCnt, nFlags, point );

Martin Baumgaertner Jul 26, 2007 - 1:55 AM

Thank you for your answer!

Unfortunately the following code always ends up with "Event NOT Handled":

class CMyReportGridWnd : public CExtPPVW < CExtReportGridWnd >
{
public:
   DECLARE_SERIAL( CMyReportGridWnd );

Technical Support Jul 25, 2007 - 1:32 PM

The OnGbwAnalyzeCellMouseClickEvent() virtual method returns a flag which indicates whether the event is handled. By default, the double click on a group row and single click on the expand box in the group row do the expanded state toggling and the double click on the data row is not handled. So, you can invoke the parent class method first and then, if it returned false, you should perform your double click analysis for the data rows only.