Added IsCellEditControlDisplayed() and use it from SetCellValue.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7206 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis
2000-04-18 10:51:38 +00:00
parent 0a47db39df
commit fa1b3a43cc
2 changed files with 22 additions and 1 deletions

View File

@@ -1068,6 +1068,7 @@ public:
void DisableCellEditControl() { EnableCellEditControl(FALSE); }
bool CanEnableCellControl() const;
bool IsCellEditControlEnabled() const;
bool IsCellEditControlDisplayed() const;
bool IsCurrentCellReadOnly() const;

View File

@@ -5945,6 +5945,23 @@ bool wxGrid::IsCellEditControlEnabled() const
return m_cellEditCtrlEnabled ? !IsCurrentCellReadOnly() : FALSE;
}
bool wxGrid::IsCellEditControlDisplayed() const
{
if (m_cellEditCtrlEnabled)
{
int row = m_currentCellCoords.GetRow();
int col = m_currentCellCoords.GetCol();
wxGridCellAttr* attr = GetCellAttr(row, col);
wxGridCellEditor* editor = attr->GetEditor(this, row, col);
if ( editor && editor->IsCreated() )
{
wxWindow *control = editor->GetControl();
return control->IsShown();
}
}
return FALSE;
}
void wxGrid::ShowCellEditControl()
{
if ( IsCellEditControlEnabled() )
@@ -7693,7 +7710,10 @@ void wxGrid::SetCellValue( int row, int col, const wxString& s )
if ( m_currentCellCoords.GetRow() == row &&
m_currentCellCoords.GetCol() == col &&
IsCellEditControlEnabled())
IsCellEditControlDisplayed())
// Note: If we are using IsCellEditControlEnabled,
// this interacts badly with calling SetCellValue from
// an EVT_GRID_CELL_CHANGE handler.
{
HideCellEditControl();
ShowCellEditControl(); // will reread data from table