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 » __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS question Collapse All
Subject Author Date
tera tera May 8, 2009 - 3:38 AM

Hello.


Only as for 3 columns, I want the width of the screen to follow the grid.

Please teach a good method.


 


Technical Support May 20, 2009 - 12:30 PM

We have 3 white columns with fixed size. We have one blue column and it’s resizable. We have one magenta column with fixed size. First of all we need to get the header cells for this column from the top header row:

CExtGridWnd & wndGrid = . . .
CExtGridCell * pHeaderCellWhite0 = wndGrid.GridCellGetOuterAtTop( 0L, 0L );
CExtGridCell * pHeaderCellWhite1 = wndGrid.GridCellGetOuterAtTop( 1L, 0L );
CExtGridCell * pHeaderCellWhite2 = wndGrid.GridCellGetOuterAtTop( 2L, 0L );
CExtGridCell * pHeaderCellBlue = wndGrid.GridCellGetOuterAtTop( 3L, 0L );
CExtGridCell * pHeaderCellMagenta = wndGrid.GridCellGetOuterAtTop( 4L, 0L );

Then, we need to set the proportional extents for these columns:
   pHeaderCellWhite0->ExtentPercentSet( 0.0 );
            pHeaderCellWhite1->ExtentPercentSet( 0.0 );
            pHeaderCellWhite2->ExtentPercentSet( 0.0 );
            pHeaderCellBlue->ExtentPercentSet( 1.0 );
            pHeaderCellMagenta->ExtentPercentSet( 0.0 );

That’s all. These columns will be automatically resizable like demonstrated on your video. But if you want to disable resizing of the white and magenta columns by user, then you also should set the fixed widths of their columns in pixels:
   INT nSomeWidthInPixels = . . .
            pHeaderCellWhite0->ExtentSet( nSomeWidthInPixels, -1 );
            pHeaderCellWhite0->ExtentSet( nSomeWidthInPixels, 0 );
            pHeaderCellWhite0->ExtentSet( nSomeWidthInPixels, 1 );
            pHeaderCellWhite1->ExtentSet( nSomeWidthInPixels, -1 );
            pHeaderCellWhite1->ExtentSet( nSomeWidthInPixels, 0 );
            pHeaderCellWhite1->ExtentSet( nSomeWidthInPixels, 1 );
            pHeaderCellWhite2->ExtentSet( nSomeWidthInPixels, -1 );
            pHeaderCellWhite2->ExtentSet( nSomeWidthInPixels, 0 );
            pHeaderCellWhite2->ExtentSet( nSomeWidthInPixels, 1 );
            pHeaderCellMagenta->ExtentSet( nSomeWidthInPixels, -1 );
            pHeaderCellMagenta->ExtentSet( nSomeWidthInPixels, 0 );
            pHeaderCellMagenta->ExtentSet( nSomeWidthInPixels, 1 );


Technical Support May 11, 2009 - 11:43 AM

The CExtGridBaseWnd::OnGbwResizingStateApply() virtual method is invoked when the column width or row height has changed during column or row resizing drag-n-dropping the separator between column or row header cells. The column and/or row resizing can be also enabled via drag-n-dropping of grid lines in the central grid area with data cells. If you need to catch the grid resizing event, then you should handle it’s WM_SIZE message.


tera tera May 12, 2009 - 1:09 AM

 Hello.


>If you need to catch the grid resizing event, then you should handle it’s WM_SIZE message.


 When a domain spreads ,

I want to make the width of 0 cells and 1 cell and 3 cells fixation.

however , Only 2 cells want to make width variable.


Is not there the good command?


Thanks,


 

Technical Support May 12, 2009 - 1:33 PM

To make a grid column having a fixed size, you should set all its extents (minimal, current and maximal) to equal values:

CExtGridWnd & wndGrid = . . .
INT nFixedColumnWidthInPixels = . . .
CExtGridCell * pCellHeader = wndGrid.GridCellGetOuterAtTop( . . . );
            pCellHeader->ExtentSet( nFixedColumnWidthInPixels, -1 );
            pCellHeader->ExtentSet( nFixedColumnWidthInPixels, 0 );
            pCellHeader->ExtentSet( nFixedColumnWidthInPixels, 1 );

tera tera May 14, 2009 - 12:07 AM

Hello.


The method how only a specific item fixes width.

Will it be the following methods?


void CNxL_MVT_BaseGrid::OnSize(UINT nType, int cx, int cy) {  CExtGridCellHeader * pExtGridCellHeader;  pExtGridCellHeader = STATIC_DOWNCAST(       CExtGridCellHeader,      GridCellGetOuterAtTop(      0 ,      0 ,      RUNTIME_CLASS(CExtGridCellHeader)  ) );  pExtGridCellHeader->ExtentSet   ( 100 );  CNxL_MlGrid::OnSize(nType, cx, cy); }

Technical Support May 15, 2009 - 4:54 AM

You can use CExtGridCell::ExtentSet() to assign the minimum, current and maximum column width in pixels and CExtGridCell::ExtentPercentSet() to set the proportional column width used for automatic column resizing. The total of all the proportional column widths is 100%. If some of column has an equal minimum and maximum width, it is not resized proportionally. This allows you to keep several columns having a fixed size when other columns are resized proportionally. If you are using proportional column resizing, the CExtGridCell::ExtentSet() method just sets the initial column width in pixels for the proportionally resized columns.

tera tera May 20, 2009 - 2:51 AM

Hello.


With the standard grid, is such a movement impossible?

http://ifreeta.dee.cc/20090520/result.avi


Is it necessary to program it in the user side?


 

Technical Support May 8, 2009 - 11:57 AM

The CExtGridBaseWnd::OnGbwResizingStateApply() virtual method is invoked to apply the new size to resized columns and/or rows. You should override this virtual method in your CExtGridWnd-derived class. Your method should invoke the parent class method and then change the size of the parent frame or dialog window. First of all you will need to compute summary width of all the columns. The CExtGridWnd::ColumnCountGet() method returns count of columns. The CExtGridWnd::GridCellGetOuterAtTop() method returns pointers to header grid cells at top. The CExtGridCell::ExtentGet() method of each header cell returns column width in pixels. So, you can compute summary width of all the columns. The next step is to compute the new width of the parent dialog or frame window:

CExtGridWnd * pWndGrid = . . .
 CWnd * pWndParent = . . . // parent dialog or  frame window.
INT nSummaryWidthOfAllTheColumns = . . . // you already computed this like we described above
CRect rcWndParent, rcGrid;
            pWndParent->GetWindowRect( &rcWndParent );
            pWndGrid->GetCientRect( &rcGrid );
INT nCurrentGridWidth = rcGrid.Width();
            if( pWndGrid->OnSwHasScrollBar( false ) )
                        nCurrentGridWidth -= ::GetSystemMetrics( SM_CXVSCROLL ); // subtract width of vertical scroll bar
INT nDiff = nSummaryWidthOfAllTheColumns - nCurrentGridWidth;
            if( nDiff == 0 )
                        return . . . // don’t need to resize the parent frame or dialog window in this case
            rcWndParent.right += nDiff;
            pWndParent->MoveWindow( &rcWndParent );

tera tera May 11, 2009 - 12:02 AM

Hello.


OnGbwResizingStateApply is not called even if I change the view area of the grid.

Why ?