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 » 2 question related CExtGridWnd Collapse All
Subject Author Date
Sorciere vn Apr 10, 2008 - 2:34 AM

1.I have a class CMyGridWnd delivered from CExtGridWnd.and i overright OnGbwAnalyzeCellMouseClickEvent(UINT nChar, UINT nRepCnt, UINT nFlags, CPoint point ) virtual function to catch mouse event.


if(nChar == VK_LBUTTON)


{


    if(nRepCnt == 1)


    { // single click


    }


    else if( nRepCnt == 2)


    { // double click


    }


}


However, it always run into single click command.Pls show me how to catch double click.I found some thread about this problem,but no approach that i try successful.


2."


A control bar automatically resizes only one child window. So your windows hierarchy should be the following: First create a control bar, then create a child dialog inside it and then put any controls, toolbars or view into the child dialog.


".


I have do as u say,but why my dialog not fit into CExtControlBar



 

Sorciere vn Apr 22, 2008 - 10:01 PM

Thanks for u reply.


Forget the question 1.However problem with My Dialog that was child of CExtDynamicControlBar also incorrect.Althought i have check properties of Dialog is Child,none border and  do not use CExtNCW template for my CDialog.Could i send my project for u to show me what i wrong?.Pls.


Best Regards,


sorciere_vn

Technical Support Apr 26, 2008 - 1:58 AM

Did you implement the resizing of the dialog child controls? Did you anchor it or use the CWnd::RepositionBars() method?
You can send us a test project that demonstrates the problem so we can find out what’s wrong.

Technical Support Apr 15, 2008 - 4:53 AM

1) You should override the CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent() virtual method:

bool CYourGrid::OnGbwAnalyzeCellMouseClickEvent(
      UINT nChar, // VK_LBUTTON, VK_RBUTTON or VK_MBUTTON only
      UINT nRepCnt, // 0 - button up, 1 - single click, 2 - double click, 3 - post single click & begin editing
      UINT nFlags, // mouse event flags
      CPoint point // mouse pointer in client coordinates
      )
{
      ASSERT_VALID( this );
      ASSERT( 0 <= nRepCnt && nRepCnt <= 3 );
      //
      // You should invoke parent class method first.
      // This will let grid window to process selection/focus by default.
      //
bool bRetVal =
            CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent(
                  nChar,
                  nRepCnt,
                  nFlags,
                  point
                  );
      //
      // Hit test the mouse click event and get grid cell.
      //
CExtGridHitTestInfo htInfo( point );
      HitTest( htInfo, false, true );
      if( (! htInfo.IsHoverEmpty() ) && htInfo.IsValidRect() )
      {
            INT nColType = htInfo.GetInnerOuterTypeOfColumn();
            INT nRowType = htInfo.GetInnerOuterTypeOfRow();
            CExtGridCell * pCell =
                  GridCellGet(
                        htInfo.m_nColNo,
                        htInfo.m_nRowNo,
                        nColType,
                        nRowType
                        );
            if( pCell != NULL )
            {
                  ASSERT_VALID( pCell );
                  if( nChar == VK_LBUTTON && nRepCnt == 2 )
                  {
                        //
                        // Some grid cell is double-clicked.
                        // It can be outer header cell or inner data cell.
                        //
                        if( nColType == 0 && nRowType == 0 )
                        {
                              //
                              // Some inner data cell is double-clicked.
                              // The htInfo.m_nColNo and htInfo.m_nRowNo properties
                              // are column and row indices.
                              //
                        }
                  }
            }
      }
      else
            bRetVal = false;
      return bRetVal;
}


2) Please make sure you created your dialog as a child of the control bar. Also ensure that you do not use CExtNCW for child dialogs because this template is used for skinning captions but child dialogs don’t have captions.

Technical Support Apr 12, 2008 - 4:31 AM

Double clicks work OK in the grid, which supports best fit adjustments for column widths/row heights (see the __EGBS_BSE_EX_DBLCLK_BEST_FIT_*** styles). The column widths are adjusted when you click on a separator between two header cells. If you return true when handling a single mouse click, a double click notification is ignored.

Please check the properties of your dialog template resource which is used as a inner dialog for resizable control bar. Your dialog should be a child and visible rather than popup or hidden.


Sorciere vn Apr 14, 2008 - 12:44 AM

Now i want to catch both single click & double click event.what must i do?here code i used :


               if (nChar == VK_LBUTTON && nRepCnt == 1 )

               {

                   AfxMessageBox(_T("single click"));

               }

                if( nRepCnt == 2 && ( nRepCnt == 2 && (dwBseStyle&__EGWS_BSE_EDIT_DOUBLE_LCLICK) != 0 ))

                {

                   

                    CExtGridHitTestInfo htInfo( point );

                    HitTest( htInfo, false, true );

                    if(( ! htInfo.IsHoverEmpty() )|| htInfo.IsValidRect())

                    {

           

                    }

           

                    INT nColType = htInfo.GetInnerOuterTypeOfColumn();

                    INT nRowType = htInfo.GetInnerOuterTypeOfRow();

                    CExtGridCell * pCell = GridCellGet(htInfo.m_nColNo,htInfo.m_nRowNo,nColType,nRowType);

                    if( pCell != NULL )

                    {

                        ASSERT_VALID( pCell );

                        AfxMessageBox(_T("double click"));

                    }

                }    

       

        return false;


And about My Dialog,i have set style is child & visible.It was show when program run,however the position don’t fit into CExtDynamicControlBar Area.and my class is class CMyDialog : public CExtNCW < CExtResizableDialog >.


regards,


sorciere_vn


PS : sorry about my english little bad,thus it is difficult to understand.

Sorciere vn Apr 10, 2008 - 4:09 AM

i update screenshot in question 2,child dialog include one Toolbar & one CExtGridWnd.


Error