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 » Join Cells bug? Collapse All
Subject Author Date
Offer Har Feb 3, 2009 - 1:15 PM

Hi,


I have a tree grid with two rows haeder which are supposed to look like this:


+--------------------+
|	 Main Header    |
+------+------+------+
| Sub1 | Sub2 | Sub3 |
+------+------+------+

This is the code I wrote to implement it:



    CExtGridCellHeader* pCellHdr = (CExtGridCellHeader*)GridCellGetOuterAtTop(0, 0, RUNTIME_CLASS(CExtGridCellHeader));
    pCellHdr->TextSet(_T("Main Row Header Tilte"));
    pCellHdr->ExtentSet(300);
    pCellHdr->ModifyStyle(__EGCS_TA_HORZ_CENTER);

    pCellHdr = (CExtGridCellHeader*)GridCellGetOuterAtTop(0, 1, RUNTIME_CLASS(CExtGridCellHeader));
    pCellHdr->TextSet(_T("Sub Title1"));
    pCellHdr->ExtentSet(100);
    pCellHdr->ModifyStyle(__EGCS_TA_HORZ_CENTER);

    pCellHdr = (CExtGridCellHeader*)GridCellGetOuterAtTop(1, 1, RUNTIME_CLASS(CExtGridCellHeader));
    pCellHdr->TextSet(_T("Sub Title2"));
    pCellHdr->ExtentSet(100);
    pCellHdr->ModifyStyle(__EGCS_TA_HORZ_CENTER);

    pCellHdr = (CExtGridCellHeader*)GridCellGetOuterAtTop(2, 1, RUNTIME_CLASS(CExtGridCellHeader));
    pCellHdr->TextSet(_T("Sub Title3"));
    pCellHdr->ExtentSet(100);
    pCellHdr->ModifyStyle(__EGCS_TA_HORZ_CENTER);

    GridCellJoinSet(CSize(3,1), 0, 0, 0 , -1);

But it does not work. This is the screen-shot of how it looks - the mail title only occupied two columns, and not three, event though I specified in the CSize(3,1), and there is another problem, that I can only resize the  columns width from the first column, the other two separators are just ignored... the cursor icon changes, but the dragging is totaly ignored.



Please explain what is wrong, either in my code, or in yours...


Thanks,


Ron.


 

Technical Support Feb 9, 2009 - 5:15 AM

Unfortunately now. But this can be done with the one line of code because the following method of the CExtGridWnd class allows to initialize more than one grid cell at a time if the nColCount and/or nRowCount parameters are greater than 1:

   virtual bool GridCellSet(
                        LONG nColNo,
                        LONG nRowNo,
                        const CExtGridCell * pCell = NULL, // NULL - clear (make empty)
                        LONG nColCount = 1L,
                        LONG nRowCount = 1L,
                        INT nColType = 0, // -1 - nColNo is fixed column at left, 1 - at right, 0 - data cell
                        INT nRowType = 0, // -1 - nRowNo is fixed column at top, 1 - at bottom, 0 - data cell
                        bool bRedraw = true
                        );


Technical Support Feb 4, 2009 - 1:20 AM

The cell joining feature requires non-NULL grid cell inside joined areas. Please initialize additional two CExtGridCellHeader grid cell objects in the top row inside the Main Header area and one more CExtGridCellHeader grid cell object above the Sub Title 3 header cell.

Offer Har Feb 4, 2009 - 4:14 AM

Got it. Now it works...


I wonder if there is no way for the library to do it automaticaly, because I merge these cells, so I don’t realy use/need them, so I end up with creating a lot of cells I will never use.