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 Tech Support » Joining cell inside a column question Collapse All
Subject Author Date
Francesco Toscano Oct 19, 2007 - 4:38 AM

For some reasons I need to join some cells along a column in a CExtGridWnd. I have used as starting point, your sample "JoinCells". In your sample, the joining is made along cells on the same row, so I have changed the code in order to perform my request. The join works, but I found some strange breaviours with it. First of all the cells selection do not work has expected, if I select the first cell joined in the column (from up to down), the selection works, then if I try to select the other cell the selection do not work.

Can you give me some suggestion and help? This is the code I used to do the join:

void CMyGrid::OnGbwAdjustRects(
        LONG nColNo,
        LONG nRowNo,
        INT nColType,
        INT nRowType,
        RECT & rcCellExtraA,
        RECT & rcCellA
        ) const
{
    ASSERT_VALID( this );
    CExtGridWnd::OnGbwAdjustRects(
        nColNo,
        nRowNo,
        nColType,
        nRowType,
        rcCellExtraA,
        rcCellA
        );

    //if(nColType == 0 &&    nRowType == 0 && nRowNo == 1)
    //    {
    //    if(nColNo == 1)
    //        {
    //        CRect rcCellA_Next, rcCellExtraA_Next;
    //        if(GridCellRectsGet(
    //                nColNo + 1,
    //                nRowNo,
    //                nColType,
    //                nRowType,
    //                &rcCellA_Next,
    //                &rcCellExtraA_Next))
    //            {
    //            rcCellA.right = rcCellA_Next.right;
    //            rcCellExtraA.right = rcCellExtraA_Next.right;
    //            }
    //        }
    //    else if(nColNo == 2)
    //        {
    //        rcCellA.left = rcCellA.right;
    //        rcCellExtraA.left = rcCellExtraA.right;
    //        }
    //    }
    if(nColType == 0 &&    nRowType == 0)
        {
        if(nRowNo == 1 && nColNo == 1)
            {
            CRect rcCellA_Next, rcCellExtraA_Next;
            if(GridCellRectsGet(
                    nColNo,
                    nRowNo + 1,
                    nColType,
                    nRowType,
                    &rcCellA_Next,
                    &rcCellExtraA_Next))
                {
                rcCellA.bottom = rcCellA_Next.bottom;
                rcCellExtraA.bottom = rcCellExtraA_Next.bottom;
                }
            }
        else if(nRowNo == 2 && nColNo == 1)
            {
            rcCellA.top = rcCellA.bottom;
            rcCellExtraA.top = rcCellExtraA.bottom;
            }
        }
}

Many thanks Francesco.