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 » About header cell Collapse All
Subject Author Date
Paolo Giustinoni Jul 15, 2006 - 4:55 AM

Is there a way to set a bottom header cell to an editable cell like CExtGridCellString?

Thanks, Paolo.

Technical Support Jul 17, 2006 - 11:41 AM

There are several grid styles with which you can enable editing for header cells:

__EGWS_BSE_EDIT_CELLS_OUTER_T - top header cells
__EGWS_BSE_EDIT_CELLS_OUTER_B - bottom header cells
__EGWS_BSE_EDIT_CELLS_OUTER_HORZ - top and bottom header cells
__EGWS_BSE_EDIT_CELLS_OUTER_L - left header cells
__EGWS_BSE_EDIT_CELLS_OUTER_R - right header cells
__EGWS_BSE_EDIT_CELLS_OUTER_VERT - left and right header cells
__EGWS_BSE_EDIT_CELLS_OUTER - all header cells

For example, to enable editing for all the cells, you can use the following line:

m_wndGrid.BseModifyStyle( __EGWS_BSE_EDIT_CELLS_OUTER, 0 );

Paolo Giustinoni Jul 17, 2006 - 1:36 PM

Thanks for your support..
I have another questione regarding the editing of a cell.
What’s the way to make a cell disable?
I mean, I have to force a user to editing only one cell, or also only one row of a grid, so, when he click outside the cell when he’s editing a particular cell, he can’t do anything; only editing this particular cell (or row). In particular, would be interesting that, when the user is editing the cell, he can’t select any other cell, or, selecting another cell, the focus come back to the cell he is editing..

Technical Support Jul 18, 2006 - 9:34 AM

Each cell in any of our grid windows can be made read-only independently from other cells. You can do this by applying the __EGCS_READ_ONLY style to the cell object (by using CExtGridCell::ModifyStyle()). Please note that this style does not disable activation of the cell editor window, i.e. read-only cells use read-only inplace edit windows. This may be useful for copying cell text into clipboard. If you need to disable activation of the inplace editor at all, simply apply __EGCS_NO_INPLACE_CONTROL.

Paolo Giustinoni Jul 18, 2006 - 12:19 PM

Can the grid notice when a user click on a cell (only the click event, not the begin of editing) without overriding the CExtGridCell::OnClick method?
My problem is the following: I have to disable one or more rows of a grid to force a user to insert data only in the last row of a grid, moreover when he click on another cell (not in the last row) and he’s in editing, the focus has to go back to the cell he’s editing.

Thanks, Paolo.

Technical Support Jul 19, 2006 - 5:32 AM

You should override the CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent() virtual method like as follows:

bool CYourGridWnd::OnGbwAnalyzeCellMouseClickEvent( UINT nChar, UINT nRepCnt, UINT nFlags, CPoint point )
{
CExtGridHitTestInfo htInfo( point ); 
    HitTest( htInfo, false, true );
    if( htInfo.IsHoverEmpty() || (! htInfo.IsValidRect() ) )
        return false;
INT nColType = htInfo.GetInnerOuterTypeOfColumn(); 
INT nRowType = htInfo.GetInnerOuterTypeOfRow();
    if( nColType == 0 && nRowType == 0 )
    { // if we are in the inner data cells area
            // PLEASE DO THE FOLLOWING HERE:
            // 1) Analyze htInfo.m_nRowNo and/or htInfo.m_nColNo
            // 2) return true if the cell click should not be processed by default
    } // if we are in the inner data cells area
    return CExtGridWnd::OnGbwAnalyzeCellMouseClickEvent( nChar, nRepCnt, nFlags, point );
}

Paolo Giustinoni Jul 20, 2006 - 6:47 AM

Many thanks for your support.
I have another one question on cells..
About a CExtGridCellDateTime, how can I show via code the built-in date control?

Thanks, Paolo

Technical Support Jul 20, 2006 - 10:39 AM

Here is the code that you can use to show a drop-down date picker:

LONG nColNo = 5L;
 LONG nRowNo = 1L;
 
 m_wndGrid.EnsureVisibleColumn( nColNo, false );
 m_wndGrid.EnsureVisibleRow( nRowNo, false );
 
 CExtGridCellDateTime * pCellDateTime0 =
  STATIC_DOWNCAST(
   CExtGridCellDateTime,
   m_wndGrid.GridCellGet( nColNo, nRowNo )
   );
 ASSERT_VALID( pCellDateTime0 );
 
 CRect rcCell, rcCellExtra;
 m_wndGrid.GridCellRectsGet(
  nColNo,
  nRowNo,
  0,
  0,
  &rcCell,
  &rcCellExtra
  );
 
 CExtGridCell::TrackCellStateInfo_t _tcsi(
  (*pCellDateTime0),
  m_wndGrid,
  INT(CExtGridCell::__EBTT_DROPDOWN),
  rcCellExtra,
  rcCell,
  nColNo,
  nRowNo,
  nColNo,
  nRowNo,
  0,
  0
  );
 pCellDateTime0->OnButtonPopupMenuTrack( _tcsi );
 
 m_wndGrid.OnSwUpdateScrollBars();
 m_wndGrid.OnSwDoRedraw();

Paolo Giustinoni Jul 20, 2006 - 9:39 AM

Another question: when I select "No Date" from a CExtGridCellDateTime, and I get the value with the GetVariant() method, I have the current date..
Why?

Many thanks, Paolo

Technical Support Jul 20, 2006 - 10:42 AM

Thank you for reporting the problem. Please update the CExtGridCellDateTime::GetVariant() method as follows:

void CExtGridCellDateTime::GetVariant( VARIANT & varCopy ) const
{
 ASSERT_VALID( this );
 ::VariantClear( &varCopy );
#pragma warning(disable: 4310)
 if( m_dtDate.GetStatus() != COleDateTime::valid )
 {
  V_VT( &varCopy ) = VT_EMPTY;
 }
 else
 {
  V_VT( &varCopy ) = VT_DATE;
  V_DATE( &varCopy ) = m_dtDate.m_dt;
 }
#pragma warning(default: 4310)
}
So when no date is set, you can retreive the variant value with VT_EMPTY type. Is this suitable for you?

Paolo Giustinoni Jul 20, 2006 - 12:07 PM

It’s perfect.. Thank you very much.
Your programs and your support worth every cent a customer spend to buy them.

Paolo Giustinoni Jul 20, 2006 - 10:22 AM

Sorry, I explain better my last post.
When I select "no date" from the date picker control in a CExtGridCellDateTime, and the cell already contain a valid date, I see that in the OnGridCellInputComplete() method, getting the date value, I have the date in the cell, and instead when I select a valid date, always from the date picker, I have the date I selected.
Why this happen, and how I can get the "no date" value?

Thanks, Paolo

Technical Support Jul 21, 2006 - 4:15 AM

In addition to what we said before, we would like to add the following. You can use CExtGridCellDateTime::GetDateTime(), which returns the current date in the COleDateTime object. When COleDateTime::GetStatus() returns COleDateTime::null, this means no date is selected.

COleDateTime dtDate = pCell->GetDateTime();
if( dtDate.GetStatus() == COleDateTime::null )
{
 // none date is selected
}