Professional UI Solutions
Site Map   /  Register


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 » Fit all cells after double click corner Collapse All
Subject Author Date
Bart Kampers Dec 10, 2010 - 3:23 AM



I want the columns in my CExtGridWnd to resize to fit when I double click the top left corner cell. So I overruled OnGbwAnalyzeCellMouseClickEvent like below.


This works OK except that resizing only takes effect after I move the cursor to another cell. Obviously I want to see the effect immediately after I double clicked. How can I do this?


Thanks in advance.


bool CGradingTableGrid::OnGbwAnalyzeCellMouseClickEvent(UINT nChar, UINT nRepCnt, UINT nFlags, CPoint point) {   bool handled = __super::OnGbwAnalyzeCellMouseClickEvent(nChar, nRepCnt, nFlags, point);

  CExtGridHitTestInfo htInfo;   htInfo.m_ptClient = point;   HitTest(htInfo, true, true);

  switch (nRepCnt)   {     case 1: // single click     {   // ...   break;     }     case 2: // double click     {   if ((htInfo.m_dwAreaFlags & (__EGBWA_OUTER_TOP | __EGBWA_OUTER_LEFT)) == (__EGBWA_OUTER_TOP | __EGBWA_OUTER_LEFT))   {     for (LONG col = 0; col < ColumnCountGet(); col++)     {   BestFitColumn(col, 0, true, true, false, true);     }     Invalidate();     handled = true;   }   break;     }   }

  return handled; }

Bart Kampers Dec 14, 2010 - 1:32 AM

Ok, I now call :








Still the columns only are resized after the mouse leaves the corner cell.

Technical Support Dec 15, 2010 - 12:51 PM

This sounds like magic. You invoke the CExtGridWnd::BestFitColumn() method with the bRedraw parameter set to true. This means the CExtGridWnd::BestFitColumn() method invokes the following and you don’t need to invoke any re-layouting code manually:

    if( bRedraw && GetSafeHwnd() != NULL )
        OnSwRecalcLayout( true );
We think the problem is with something else. Could you create a small test project reproducing this problem and send it to us?.

Bart Kampers Dec 13, 2010 - 1:13 AM

I also tried OnSwDoRedraw()

Technical Support Dec 13, 2010 - 10:36 AM

If OnSwUpdateScrollBars() is invoked after OnSwRecalcLayout( true ), it recomputes everything.

Technical Support Dec 12, 2010 - 11:25 PM

Please invoke OnSwUpdateScrollBars() before Invalidate().

Bart Kampers Dec 13, 2010 - 1:09 AM

Thanks for your response but this has no effect.