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 |
|
tera tera
|
May 17, 2009 - 7:53 PM
|
Hello. When I push the cell button and execute RowRemoveAll of own.
Assert appears.
I am troubled.
Please teach measures method. http://ifreeta.dee.cc/20090518/SampleMuGrid200904.lzh bool CNxL_MlGrid::OnGridCellButtonPressed(
CExtGridCell & _cell,
INT nButtonType,
const RECT & rcCellExtra,
const RECT & rcCell,
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType
)
{ RowRemoveAll(); return true;
}
|
|
Technical Support
|
May 19, 2009 - 1:18 AM
|
Thank you for reporting this issue. To fix it, please update the source code for the following method:
bool CExtGridWnd::OnGridTrackCellButton(
CExtGridCell * pCell,
const CExtGridHitTestInfo & htInfo
)
{
ASSERT_VALID( this );
ASSERT_VALID( pCell );
ASSERT( (htInfo.m_dwAreaFlags&__EGBWA_CELL_BUTTON) != 0 );
ASSERT( htInfo.m_nButtonType >= 0 );
static CExtGridCell * g_pTrackCell = NULL;
if( g_pTrackCell != NULL )
return false;
if( htInfo.m_rcPart.left >= htInfo.m_rcPart.right
|| htInfo.m_rcPart.top >= htInfo.m_rcPart.bottom
)
return false;
bool bEnabled = false;
bool bStayPressed = false;
UINT nTimerElapseValue = 0;
if( ! pCell->OnQueryButtonInfo(
htInfo.m_nButtonType,
this,
htInfo.m_nColNo,
htInfo.m_nRowNo,
htInfo.GetInnerOuterTypeOfColumn(),
htInfo.GetInnerOuterTypeOfRow(),
&bEnabled,
NULL,
&bStayPressed,
&nTimerElapseValue
)
)
return false;
if( ! bEnabled )
return false;
g_pTrackCell = pCell;
g_pTrackCell->OnChangeButtonPressedState(
htInfo.m_nButtonType,
true
);
InvalidateRect( &htInfo.m_rcPart );
ULONG nPressedTimerCounter = 0L;
if( nTimerElapseValue > 0 )
SetTimer( m_nTimerIdPressedButton, nTimerElapseValue, NULL );
HWND hWndGrid = m_hWnd;
CExtMouseCaptureSink::SetCapture( hWndGrid );
bool bStopFlag = false;
bool bPressedEvent = false;
bool bMouseInsideButton = true;
for( MSG msg;
::IsWindow( hWndGrid )
&& (!bStopFlag)
&& (g_pTrackCell != NULL)
;
)
{ // main message loop
if( ! ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
{
if( ( ! ::IsWindow( hWndGrid ) )
|| bStopFlag
|| g_pTrackCell == NULL
)
break;
if( CExtGridWnd::g_bEnableOnIdleCalls )
{
for( LONG nIdleCounter = 0L;
::AfxGetThread()->OnIdle(nIdleCounter);
nIdleCounter ++
);
}
::WaitMessage();
continue;
} // if( ! ::PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) )
switch( msg.message )
{
case WM_KILLFOCUS:
if( msg.hwnd == hWndGrid )
bStopFlag = true;
break;
case WM_CANCELMODE:
case WM_ACTIVATEAPP:
case WM_SYSCOMMAND:
case WM_SETTINGCHANGE:
case WM_SYSCOLORCHANGE:
bStopFlag = true;
break;
case WM_COMMAND:
if( (HIWORD(msg.wParam)) == 0
|| (HIWORD(msg.wParam)) == 1
)
bStopFlag = true;
break;
case WM_CAPTURECHANGED:
if( (HWND)msg.wParam != hWndGrid )
bStopFlag = true;
break;
case WM_TIMER:
if( msg.hwnd == hWndGrid
&& UINT(msg.wParam) == m_nTimerIdPressedButton
)
{ // if pressed button timer event
ASSERT_VALID( this );
ASSERT_VALID( g_pTrackCell );
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
g_pTrackCell->OnButtonPressing(
*this,
htInfo.m_nButtonType,
bMouseInsideButton,
nPressedTimerCounter,
htInfo.m_rcPart,
htInfo.m_rcExtra,
htInfo.m_rcItem,
htInfo.m_nColNo,
htInfo.m_nRowNo,
htInfo.GetInnerOuterTypeOfColumn(),
htInfo.GetInnerOuterTypeOfRow()
);
nPressedTimerCounter ++;
continue;
} // if pressed button timer event
break;
case WM_MOUSEWHEEL:
if( msg.hwnd != hWndGrid )
bStopFlag = true;
else
{
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
continue;
} // else from if( msg.hwnd != hWndGrid )
break;
case WM_MOUSEMOVE:
if( msg.hwnd != hWndGrid )
bStopFlag = true;
else
{
ASSERT_VALID( this );
ASSERT_VALID( g_pTrackCell );
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
CPoint point;
point = DWORD( msg.lParam );
bool bInside =
htInfo.m_rcPart.PtInRect(point) ? true : false;
if( bMouseInsideButton != bInside )
{
bMouseInsideButton = bInside;
g_pTrackCell->OnChangeButtonPressedState(
htInfo.m_nButtonType,
bMouseInsideButton
);
InvalidateRect( &htInfo.m_rcPart );
} // if( bMouseInsideButton != bInside )
continue;
} // else from if( msg.hwnd != hWndGrid )
break;
case WM_LBUTTONUP:
bStopFlag = true;
if( msg.hwnd == hWndGrid )
{
ASSERT_VALID( this );
ASSERT_VALID( g_pTrackCell );
CPoint point;
point = DWORD( msg.lParam );
if( htInfo.m_rcPart.PtInRect(point) )
{
bPressedEvent = true;
if( bMouseInsideButton != bPressedEvent )
{
bMouseInsideButton = bPressedEvent;
if( ( ! bMouseInsideButton )
&& nTimerElapseValue > 0
)
{
KillTimer( m_nTimerIdPressedButton );
nPressedTimerCounter = 0L;
}
g_pTrackCell->OnChangeButtonPressedState(
htInfo.m_nButtonType,
bMouseInsideButton
);
InvalidateRect( &htInfo.m_rcPart );
} // if( bMouseInsideButton != bPressedEvent )
} // if( htInfo.m_rcPart.PtInRect(point) )
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
} // if( msg.hwnd == hWndGrid )
break;
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_RBUTTONUP:
case WM_RBUTTONDBLCLK:
case WM_RBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MBUTTONDBLCLK:
case WM_MBUTTONDOWN:
case WM_CONTEXTMENU:
case WM_NCLBUTTONUP:
case WM_NCLBUTTONDBLCLK:
case WM_NCLBUTTONDOWN:
case WM_NCRBUTTONUP:
case WM_NCRBUTTONDBLCLK:
case WM_NCRBUTTONDOWN:
case WM_NCMBUTTONUP:
case WM_NCMBUTTONDBLCLK:
case WM_NCMBUTTONDOWN:
bStopFlag = true;
break;
default:
if( WM_KEYFIRST <= msg.message
&& msg.message <= WM_KEYLAST
)
bStopFlag = true;
break;
} // switch( msg.message )
if( bStopFlag )
break;
if( ! ::AfxGetThread() -> PumpMessage() )
break;
} // message loop
g_pTrackCell = NULL;
if( ! ::IsWindow( hWndGrid ) )
return true;
KillTimer( m_nTimerIdPressedButton );
if( nTimerElapseValue > 0 )
{
nPressedTimerCounter = 0L;
}
if( CExtMouseCaptureSink::GetCapture() == hWndGrid )
CExtMouseCaptureSink::ReleaseCapture();
ASSERT( CWnd::FromHandlePermanent(hWndGrid) == this );
ASSERT_VALID( this );
ASSERT_VALID( pCell );
if( bPressedEvent )
{
if( (!bStayPressed) && bMouseInsideButton )
{
bMouseInsideButton = false;
pCell->OnChangeButtonPressedState(
htInfo.m_nButtonType,
false
);
} // if( (!bStayPressed) && bMouseInsideButton )
INT nColType = htInfo.GetInnerOuterTypeOfColumn(), nRowType = htInfo.GetInnerOuterTypeOfRow();
pCell->OnButtonPressed(
*this, htInfo.m_nButtonType, htInfo.m_rcExtra, htInfo.m_rcItem,
htInfo.m_nVisibleColNo, htInfo.m_nVisibleRowNo, htInfo.m_nColNo, htInfo.m_nRowNo, nColType, nRowType
);
CExtGridCell * pCellTest = GridCellGet( htInfo.m_nColNo, htInfo.m_nRowNo, nColType, nRowType, NULL, false, false );
if( LPVOID(pCellTest) != LPVOID(pCell) )
return true;
} // if( bPressedEvent )
if( bMouseInsideButton )
pCell->OnChangeButtonPressedState(
htInfo.m_nButtonType,
false
);
InvalidateRect( &htInfo.m_rcPart );
return true;
}
|
|