diff --git a/doc/salome/gui/SMESH/input/selection_filter_library.doc b/doc/salome/gui/SMESH/input/selection_filter_library.doc
index a921d8576..70dc9a65f 100644
--- a/doc/salome/gui/SMESH/input/selection_filter_library.doc
+++ b/doc/salome/gui/SMESH/input/selection_filter_library.doc
@@ -42,6 +42,9 @@ the whole \b Mesh, the Initial Selection or the Current Group.
existing filter from Selection filter library and Add
to... button gives you a possibility to save your current filter
in the Library.
+\n Note: If button Apply and Close is disabled, there
+is no selected mesh in Object Browser and the filter can not be
+created. You have to select the mesh and the button will be enabled.
\image html a-filteronedges.png
@@ -150,4 +153,4 @@ the point of view of MED convention.
-*/
\ No newline at end of file
+*/
diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx
index 5758ddf7b..19e13e85d 100755
--- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx
+++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx
@@ -2192,6 +2192,10 @@ void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg)
void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh)
{
myMesh = theMesh;
+ if ( myMesh->_is_nil() ) {
+ myButtons[BTN_OK]->setEnabled(false);
+ myButtons[BTN_Apply]->setEnabled(false);
+ }
}
//=======================================================================
@@ -2526,6 +2530,14 @@ void SMESHGUI_FilterDlg::onSelectionDone()
int aRow, aCol;
const SALOME_ListIO& aList = mySelector->StoredIObjects();
+ if ( myMesh->_is_nil() && aList.Extent()>0 ) {
+ myMesh = SMESH::IObjectToInterface(aList.First());
+ if ( !(myMesh->_is_nil()) ) {
+ myButtons[BTN_OK]->setEnabled(true);
+ myButtons[BTN_Apply]->setEnabled(true);
+ }
+ }
+
if (aList.Extent() != 1 ||
!myTable->CurrentCell(aRow, aCol) ||
myTable->GetCriterionType(aRow) != FT_BelongToGeom &&
@@ -2545,6 +2557,7 @@ void SMESHGUI_FilterDlg::onSelectionDone()
}
}
+
//=======================================================================
// name : SMESHGUI_FilterDlg::onCriterionChanged
// Purpose : SLOT called when cretarion of current row changed. Update selection