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 » how to set height of different rows in grid? Collapse All
Subject Author Date
Anil Siddhpura Feb 24, 2010 - 11:40 PM

Hi,

How to set different height of different rows in grid? Is it possible to set like this?

Or is it possible to hide any perticular row?

Also, how to disable any perticular row in grid instead of disabling the whole grid?

Thanks in Advance!

Technical Support Feb 26, 2010 - 1:33 PM

The code snippet in your message shows the basic grid control initialization. You should not invoke the pCellNumber->ExtentSet(0); line of code for data cell. You should invoke it for outer header cell at left. That’s why the variable row heights was not initialized correctly. You should initialize the header cells at left for all your grid rows (the CExtGridWnd::GridCellGetOuterAtLeft() and the CExtGridCellHeader cell type). This should be done for each row.

You can set the row height to zero. This row will look like hidden. But the up and down keyboard keys will not jump over such zero height rows. So, you should use the really hidden rows instead.

Technical Support Mar 1, 2010 - 4:27 AM

Please take a look at the Order Details grid in the SimpleGrids sample application. It supports rows of variable size and the user can resize any row. This grid is initialized in the CDemoGrid::_InitDemoTable_OrderDetails() method and here is how to initialize the header cells at left when initializing each row:

               for( LONG nRowNo = 0L; nRowNo < nRowCount; nRowNo++ )
                        {
                                    CExtGridCellHeader * pCellHeaderAtLeft =
                                                STATIC_DOWNCAST(
                                                            CExtGridCellHeader,
                                                            GridCellGetOuterAtLeft(
                                                                        0L,
                                                                        nRowNo,
                                                                        RUNTIME_CLASS(CExtGridCellHeader)
                                                                        )
                                                            );
                        . . .

Anil Siddhpura Feb 26, 2010 - 11:15 PM

Hi,

How to initialize the header cells at left for all grid rows . And how to use the CExtGridWnd::GridCellGetOuterAtLeft() and the CExtGridCellHeader cell type.

Can you provide the sample code to set height for individual rows?

Technical Support Feb 25, 2010 - 1:19 PM

We suspect your question is related to the CExtGridWnd control - not to any other grid control provided with Prof-UIS.
First of all, please ensure you created it without the __EGBS_FIXED_SIZE_ROWS<.code> style rows. Second, you need some outer column at left with the <code>CExtGridCellHeader header grid cells initialized in it because the grid control uses these header grid cells for keeping the minimal, maximal and current row heights. The CExtGridCell::ExtentSet() method invoked for these header cells allows you to specify variable row heights. If you don’t want to see the outer header column at the left side of your grid control, then you can simply make it zero widths using the CExtGridBaseWnd::OuterColumnWidthSet() method.

The CExtGridWnd::RowHide() method hides the grid rows. If your code hides one row, then the total number of rows in your grid control becomes less by one. The just hidden row becomes inaccessible but it’s still stored inside the grid control. The CExtGridWnd::RowUnHideAll() shows all the previously hidden rows.

The grid cells are not dialog controls. They cannot be disabled. But you can make them read only by applying the __EGCS_READ_ONLY grid cell style. The read only grid cells allow the in-place editor window activation but the activated editor is always in the read only mode. The __EGCS_NO_INPLACE_CONTROL extended grid cell style allows you to disable editing of particular grid cells.

Anil Siddhpura Feb 26, 2010 - 12:48 AM

Hi,

Thanks for your reply.

I want to set height of different rows. I mean one row’s height to be 20 and another row’s height to be 10.

Here is the sample code for that :

m_2DTechProGrid.BseModifyStyle(0,__EGWS_BSE_EDIT_SINGLE_LCLICK|__EGWS_BSE_EDIT_SINGLE_FOCUSED_ONLY|__EGWS_BSE_EDIT_DOUBLE_LCLICK|__EGWS_BSE_EDIT_RETURN_CLICK|__EGWS_BSE_EDIT_CELLS_INNER|__EGWS_BSE_EDIT_AUTO,false);
    m_2DTechProGrid.SiwModifyStyle(__EGBS_SFB_CELLS,0,false);
    

    // PROPERTIES
    m_2DTechProGrid.DefaultRowHeightSet(32);
    m_2DTechProGrid.HoverEventsSet( true, true );
    m_2DTechProGrid.HoverHighlightSet( true, false, false, false, true, true );
    m_2DTechProGrid.OuterRowCountTopSet( 1L, false );
    m_2DTechProGrid.OuterColumnCountLeftSet( 1L, false );
    m_2DTechProGrid.OuterColumnCountRightSet( 1L, false );
    m_2DTechProGrid.OuterColumnWidthSet( true, 0L, 0 );
    m_2DTechProGrid.OuterColumnWidthSet( false, 0L, 0 );
    m_2DTechProGrid.NoHideSelectionSet( true, false );
    m_2DTechProGrid.SubtractSelectionAreasSet( true, false );
    m_2DTechProGrid.LbExtSelectionSet( true );
    m_2DTechProGrid.GridLinesHorzSet( true, false );
    m_2DTechProGrid.GridLinesVertSet( true, false );
    m_2DTechProGrid.MultiAreaSelectionSet( true );
    m_2DTechProGrid.HoverEventsSet( false, false );
    
    SetData();
    
    propSettings_.callbackReadSettings(szXmlFileName_,C2DTech_);
    
    //CExtGridCellHeader
     CExtGridCellHeader* pCellHeaderAtTop =STATIC_DOWNCAST(CExtGridCellHeader,m_2DTechProGrid.GridCellGetOuterAtTop(0,0,RUNTIME_CLASS(CExtGridCellHeader)));

    pCellHeaderAtTop->ExtentSet( g_PaintManager->UiScalingDo( 137, CExtPaintManager::__EUIST_X ) );
    pCellHeaderAtTop->TextSet(_T("Value"));
    pCellHeaderAtTop->TextColorSet(CExtGridCell::__ECS_NORMAL,RGB(0,0,0));
    pCellHeaderAtTop->FontWeightSet( FW_BOLD );
    
    pCellHeaderAtTop = STATIC_DOWNCAST(CExtGridCellHeader,m_2DTechProGrid.GridCellGetOuterAtTop(1,0,RUNTIME_CLASS(CExtGridCellHeader)));

    pCellHeaderAtTop->ExtentSet( g_PaintManager->UiScalingDo( 112, CExtPaintManager::__EUIST_X ) );
    pCellHeaderAtTop->TextSet(C2DTech_->strDecodedValue_);
    pCellHeaderAtTop->ModifyStyle(__EGCS_EX_WRAP_TEXT);
    pCellHeaderAtTop->TextColorSet(CExtGridCell::__ECS_NORMAL,RGB(0,0,0));
    pCellHeaderAtTop->FontWeightSet( FW_BOLD );


    m_2DTechProGrid.RowInsert(RowNo);

    pCellString = STATIC_DOWNCAST(CExtGridCellString,m_2DTechProGrid.GridCellGet(0,RowNo,0,0,RUNTIME_CLASS(CExtGridCellString)));
    pCellString ->TextSet(strTitle);
    pCellString->TextColorSet(CExtGridCell::__ECS_ALL, RGB(0,0,0));
    pCellString->FontWeightSet( FW_BOLD );

    pCellNumber = STATIC_DOWNCAST(CExtGridCellNumber, m_2DTechProGrid.GridCellGet( 1,RowNo,0,0,RUNTIME_CLASS(CExtGridCellNumber)));
    pCellNumber->_VariantAssign( 0 );

    pCellNumber->ExtentSet(0);
or
    pCellNumber->ExtentSet( g_PaintManager->UiScalingDo(5, CExtPaintManager::__EUIST_Y));

    pCellNumber->ModifyStyle( __EGCS_TA_HORZ_LEFT );
    pCellNumber->ModifyStyleEx(__EGWS_BSE_EDIT_DOUBLE_LCLICK);

    RowNo++;

I have set outercolumn at left as you mentioned. But, still i am not able to set height of rows.

What I exactly want to do is, I have created one gird and there are around 10 rows.

Now i want to hide 3 of the rows from grid. So for that i want to set height of that 3 rows to be 0. ON some operation I will show those rows so again i can set the height of those rows.

Also, I don’t want to use RowHide(). Because it will decrease my total row count. So I don’t want to use that.

So please let me know how can I set any perticular row’s height to 0. ANd again be able to set desire height for the same rows.

I hope you will get some idea from my sample code which i have shown here.

Thanks in Advance.