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.
Subject |
Author |
Date |
|
Rado Manzela
|
Jan 31, 2011 - 5:35 AM
|
I create date time cell, set this options:
d->ModifyStyle(__EGCS_BUTTON_DROPDOWN,0); d->SetMode(CExtGridCellDateTime::date);
Cell is initially empty. When I click into cell to start edit, then press "1", it puts there some date like 1.January....... Then I open the calendar control, click to "none" button to erase the date. When I select cell to start edit and press "1" again, in debug mode it asserts in
CExtDateTimeWnd::stat_GetDaysInMonth( INT nYear, INT nMonth )
at
ASSERT( dt1.GetStatus() == COleDateTime::valid || dt1.GetStatus() == COleDateTime::null );
nMonth is -1
I’m trying it with 2.92 Can you check it please? Thank you.
|
|
Technical Support
|
Jan 31, 2011 - 11:17 AM
|
Thank you for reporting this issue. To fix it, please update the source code for the CExtGridInplaceDateTime::Create() virtual method in the ExtGridWnd.h file:
virtual bool Create()
{
__EXT_DEBUG_GRID_ASSERT_VALID( this );
__EXT_DEBUG_GRID_ASSERT( m_hWnd == NULL );
if( m_wndGrid.GetSafeHwnd() == NULL )
{
__EXT_DEBUG_GRID_ASSERT( FALSE );
delete this;
return false;
}
DWORD dwAreaFlags =
CExtGridHitTestInfo::CellTypesToAreaFlags(
m_nColType,
m_nRowType
);
bool bFontMustBeDestroyed = false;
HFONT hCellFont = m_cell.OnQueryCellFont( m_wndGrid, m_nVisibleColNo, m_nVisibleRowNo, m_nColNo, m_nRowNo, m_nColType, m_nRowType, dwAreaFlags, bFontMustBeDestroyed );
HFONT hFont = hCellFont;
if( hFont == NULL )
{
hFont = (HFONT)
m_wndGrid.OnSiwGetDefaultFont().GetSafeHandle();
if( hFont == NULL )
hFont = (HFONT)
::GetStockObject(DEFAULT_GUI_FONT);
if( hFont == NULL )
{
if( hFont == NULL )
hFont = (HFONT)
::GetStockObject(SYSTEM_FONT);
if( hFont == NULL )
{
__EXT_DEBUG_GRID_ASSERT( FALSE );
delete this;
return false;
}
}
}
LOGFONT lf;
__EXT_DEBUG_GRID_VERIFY( ::GetObject(hFont,sizeof(LOGFONT),&lf) );
if( bFontMustBeDestroyed
&& hCellFont != NULL
)
::DeleteObject( hCellFont );
if( ! m_font.CreateFontIndirect(&lf) )
{
__EXT_DEBUG_GRID_ASSERT( FALSE );
delete this;
return false;
}
UINT nDrawTextFlags = m_cell.OnQueryDrawTextFlagsForInplaceEdit( m_nVisibleColNo, m_nVisibleRowNo, m_nColNo, m_nRowNo, m_nColType, m_nRowType, dwAreaFlags, 0 );
bool bReadOnly = false;
bool bPassword = false;
COLORREF clrText = COLORREF(-1L);
COLORREF clrBack = COLORREF(-1L);
m_cell.OnInplaceControlQueryStyle(
m_wndGrid, this, m_nVisibleColNo, m_nVisibleRowNo, m_nColNo, m_nRowNo, m_nColType, m_nRowType,
dwAreaFlags, bReadOnly, bPassword, clrBack, clrText
);
COLORREF clrTextAll = m_cell.TextColorGet( CExtGridCell::__ECS_ALL );
COLORREF clrTextNormal = m_cell.TextColorGet( CExtGridCell::__ECS_NORMAL );
if( clrTextAll != COLORREF(-1L) )
clrText = clrTextAll;
else if( clrTextNormal != COLORREF(-1L) )
clrText = clrTextNormal;
COLORREF clrBackAll = m_cell.BackColorGet( CExtGridCell::__ECS_ALL );
COLORREF clrBackNormal = m_cell.BackColorGet( CExtGridCell::__ECS_NORMAL );
if( clrBackAll != COLORREF(-1L) )
clrBack = clrBackAll;
else if( clrBackNormal != COLORREF(-1L) )
clrBack = clrBackNormal;
if( clrText != COLORREF(-1L) )
SetTextColor( clrText );
if( clrBack != COLORREF(-1L) )
SetBkColor( clrBack );
m_bInConstruction = true;
CExtGIED < CExtGIE < CExtDateTimeWnd > > :: Create( &m_wndGrid, m_rcInplaceControl );
if( m_hWnd == NULL )
{
__EXT_DEBUG_GRID_ASSERT( FALSE );
delete this;
return false;
}
SetFont( &m_font );
CExtGridCellDateTime * pCell = DYNAMIC_DOWNCAST( CExtGridCellDateTime, &m_cell );
__EXT_DEBUG_GRID_ASSERT( pCell != NULL );
__EXT_DEBUG_GRID_ASSERT_VALID( pCell );
CExtGridCellDateTime::eMode_t eMode = pCell->GetMode();
SetMode( (eMode_t)eMode );
CExtGridCellDateTime::eTimeFormat_t eTimeFormat = pCell->GetTimeFormat();
SetTimeFormat( (eTimeFormat_t)eTimeFormat );
// synchronize item’s visible status
if( eMode == CExtGridCellDateTime::date || eMode == CExtGridCellDateTime::all )
{
SetShowItem( CExtDurationWnd::year, pCell->IsItemVisible( CExtGridCellDateTime::year ), false );
SetShowItem( CExtDurationWnd::month, pCell->IsItemVisible( CExtGridCellDateTime::month ), false );
SetShowItem( CExtDurationWnd::month_name_short, pCell->IsItemVisible( CExtGridCellDateTime::month_name_short ), false );
SetShowItem( CExtDurationWnd::month_name_long, pCell->IsItemVisible( CExtGridCellDateTime::month_name_long ), false );
SetShowItem( CExtDurationWnd::day, pCell->IsItemVisible( CExtGridCellDateTime::day ), false );
}
if( eMode == CExtGridCellDateTime::time || eMode == CExtGridCellDateTime::all )
{
SetShowItem( CExtDurationWnd::hour, pCell->IsItemVisible( CExtGridCellDateTime::hour ), false );
SetShowItem( CExtDurationWnd::minute, pCell->IsItemVisible( CExtGridCellDateTime::minute ), false );
SetShowItem( CExtDurationWnd::second, pCell->IsItemVisible( CExtGridCellDateTime::second ), false );
SetShowItem( CExtDurationWnd::designator, pCell->IsItemVisible( CExtGridCellDateTime::designator ), false );
}
if( ( nDrawTextFlags & DT_RIGHT ) != NULL )
SetAlign( right );
else if( ( nDrawTextFlags & DT_CENTER ) != NULL )
SetAlign( center );
else
SetAlign( left );
DWORD dwCellStyle = m_cell.GetStyle();
if( (dwCellStyle&__EGCS_READ_ONLY) != 0 || bReadOnly )
SetReadOnly( true );
if( m_cell.IsUndefined()
|| m_cell.IsEmpty()
)
m_dtPrevious = COleDateTime::GetCurrentTime();
else
m_dtPrevious = pCell->GetDateTime();
if( m_dtPrevious.GetStatus() != COleDateTime::valid )
m_dtPrevious = COleDateTime::GetCurrentTime();
m_dtInitial = m_dtPrevious;
SetDateTime( m_dtInitial, false );
UpdateDurationWnd( true );
SetWindowPos( &CWnd::wndTop,0,0,0,0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_SHOWWINDOW );
SetFocus();
m_bInConstruction = false;
return true;
}
|
|