interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, std::string datadir, wxEvtHandler * evtHandler)
 {
-       _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(450,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER);
+       _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(300,900),
+                            wxFRAME_TOOL_WINDOW|
+                            wxSYSTEM_MENU |
+                            wxCAPTION |
+                            wxCLIP_CHILDREN|  wxSTAY_ON_TOP | //wxFRAME_FLOAT_ON_PARENT |
+                            wxRESIZE_BORDER);
        _newframe->SetMinSize( wxSize(200,200) );
        if(interfmainpanel == NULL)
        {
 
 interfMainPanel* interfMainPanel::getInstance(wxWindow* parent, wxEvtHandler * evtHandler)
 {
-       _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(450,900),wxFRAME_TOOL_WINDOW|wxSYSTEM_MENU | wxCAPTION |  wxCLIP_CHILDREN |wxFRAME_FLOAT_ON_PARENT | wxRESIZE_BORDER);
+       _newframe = new wxFrame(parent, -1, wxT(" Contour Tools "), wxPoint(25,50), wxSize(300,900),
+                            wxFRAME_TOOL_WINDOW|
+                            wxSYSTEM_MENU |
+                            wxCAPTION |
+                            wxCLIP_CHILDREN |
+                            wxFRAME_FLOAT_ON_PARENT |
+                            wxRESIZE_BORDER);
        _newframe->SetMinSize( wxSize(200,200) );
        if(interfmainpanel == NULL)
        {
        if(manualModel==NULL)
        {
         wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Please select a Contour"), wxT("Warning"), wxOK | wxICON_EXCLAMATION);
+        dial->Raise();
+//        dial->Show(true);
+        dial->SetFocus();
+
                dial->ShowModal();
                return;
        }
 
 
 DEFINE_EVENT_TYPE( wxINSTANT_CHANGE )
 
-
+/*
        //------------------------------------------------------------------------------------------------------------
        // Constructors & Destructors
        //------------------------------------------------------------------------------------------------------------
                initializeScenceManager();
        }
 
+*/
+
+
+//------------------------------------------------------------------------------------------------------------
+// Constructors & Destructors
+//------------------------------------------------------------------------------------------------------------
+//:wxScrolledWindow(parent, -1, pos, size, style)
+wxContourViewPanel::wxContourViewPanel ( vtkImageData * theShowingImage, wxWindow *parent, const wxPoint& pos, const wxSize& size,long style, int vertStart, int vertEnd, int horzStart, int horzEnd )
+:wxPanel(parent, -1, pos, size, style)
+{
+    _horizontalBar = NULL;
+    _verticalBar   = NULL;
+    theShowingImage->GetSpacing(last_spacing);
+    showingVID                 = theShowingImage;
+    _showBeforeContour        = false;
+    _showAfterContour        = false;
+    int gapH                 = 20;
+    int gapV                 = 10;
+    _verticalConceptName     = "";
+    _horizontalConceptName     = "";
+//    createHorizontalBar(1,80);
+//    createVerticalBar(1,200);
+    createViewPanel();
+    _eventHandler             = NULL;
+//    wxFlexGridSizer * panelSizer = new wxFlexGridSizer(1,4,  gapV, gapH);
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+//    panelSizer -> AddGrowableCol(2);
+//    panelSizer -> AddGrowableRow(2);
+#else
+//    panelSizer -> AddGrowableRow(0,1);
+//    panelSizer -> AddGrowableCol(2,1);
+#endif
+//    panelSizer->Add(_verticalBar, 0, wxEXPAND);
+//    panelSizer->AddSpacer(gapV);
+//    panelSizer->Add(theViewPanel, 1, wxEXPAND);
+//    panelSizer->AddSpacer(gapV);
+//    outSizer = new wxFlexGridSizer(3, 1, gapH, gapV);
+//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
+#if wxMAJOR_VERSION <= 2
+//    outSizer -> AddGrowableCol(1);
+//    outSizer -> AddGrowableRow(1);
+#else
+//    outSizer -> AddGrowableRow(1,1);
+//    outSizer -> AddGrowableCol(0,1);
+#endif
+//    outSizer->Add( _horizontalBar, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP);
+//    outSizer->Add( panelSizer, 1, wxEXPAND);
+//    outSizer->AddSpacer(gapH);
+//    _horizontalBar->setDeviceBlitStart( _verticalBar->GetWidth() + 2*gapH, gapV);
+//    _horizontalBar->setDeviceEndMargin( 2*gapH+10 );
+    //Connecting the events to the horizontal bar
+//    Connect(_horizontalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Horizontal );
+//    Connect(_horizontalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Horizontal );
+//    Connect(_horizontalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Horizontal );
+//    Connect(_horizontalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Horizontal );
+//    Connect(_horizontalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Horizontal );
+//    Connect(_horizontalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Horizontal );
+
+    //Connecting the events to the vertical bar
+//    Connect(_verticalBar->GetId(),wxEVT_TSBAR,(wxObjectEventFunction) (wxCommandEventFunction) &wxContourViewPanel::onBarrange_Vertical );
+//    Connect(_verticalBar->GetId(),wxEVT_TSBAR_ACTUAL,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onActualChange_Bar_Vertical );
+//    Connect(_verticalBar->GetId(),wxEVT_TSBAR_START,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onStartChange_Bar_Vertical );
+//    Connect(_verticalBar->GetId(),wxEVT_TSBAR_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onEndChange_Bar_Vertical );
+//    Connect(_verticalBar->GetId(),wxEVT_SELECTION_END,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onSelectionEnd_Vertical );
+//    Connect(_verticalBar->GetId(),wxEVT_TSBAR_MOVED,(wxObjectEventFunction) (wxCommandEventFunction)  &wxContourViewPanel::onMovedBar_Vertical );
+
+//    this->SetSizer( outSizer );
+
+    
+//    wxBoxSizer *outSizerNew = new wxBoxSizer(wxHORIZONTAL);
+//    wxFlexGridSizer *outSizerNew = new wxFlexGridSizer(1,1,0,0);
+//    outSizerNew->Add(theViewPanel,0,wxEXPAND);
+    
+    wxBoxSizer *outSizerNew = new wxBoxSizer(wxHORIZONTAL);
+    outSizerNew->Add(theViewPanel, 1, wxGROW, 0);
+    
+    this->SetSizer( outSizerNew );
+
+    this->SetAutoLayout( true );
+    this->Layout();
+    //SetSize(1900,1900);
+    //theViewPanel->SetSize(800,600);
+    //theViewPanel->GetWindow(1)->SetSize(800,600);
+    //outSizer->Fit( this );
+    initializeScenceManager();
+}
+
+
+
 
        wxContourViewPanel :: ~wxContourViewPanel()
        {
        */
        void wxContourViewPanel :: setStartVertical( int nwValue )
        {
-                _verticalBar->SetEnd( nwValue );
+        if (_verticalBar!=NULL) {
+            _verticalBar->SetEnd( nwValue );
+        } // if
        }
        /**
        * Sets the EndVertical value
        */
        void wxContourViewPanel :: setEndVertical( int nwValue )
        {
-                _verticalBar->SetEnd( nwValue );
+        if (_verticalBar!=NULL) {
+            _verticalBar->SetEnd( nwValue );
+        } // if
        }
        /**
        * Sets the ActualVertical value
        */
        void wxContourViewPanel :: setActualVertical( int nwValue )
        {
-                _verticalBar->SetActual( nwValue );
+        if (_verticalBar!=NULL) {
+            _verticalBar->SetActual( nwValue );
+        } // if
        }
 
        /**
        */
        void wxContourViewPanel :: setStartHorizontal( int nwValue )
        {
-               _horizontalBar->SetStart( nwValue );
+        if (_horizontalBar!=NULL) {
+            _horizontalBar->SetStart( nwValue );
+        } // if
        }
        /**
        * Sets the EndHorizontal value
        */
        void wxContourViewPanel :: setEndHorizontal( int nwValue )
        {
-               _horizontalBar->SetEnd( nwValue );
+        if (_horizontalBar!=NULL) {
+            _horizontalBar->SetEnd( nwValue );
+        } // if
        }
        /**
        * Sets the ActualHorizontal value
        */
        void wxContourViewPanel :: setActualHorizontal( int nwValue )
        {
-               _horizontalBar->SetActual( nwValue );
+        if (_horizontalBar!=NULL) {
+            _horizontalBar->SetActual( nwValue );
+        } // if
        }
 
        /**
 
                _configuration = configurationElem;
                //--- groupConfig -> format: ("## ## # ## "), #:any positive integer number, : space needed between the numbers and at the end of the string.
                setVerticalMaxSelectedNums( groupConfig );
-               
                //_configuration = "CCCc";
                //setVerticalMaxSelectedNums( "1 2 3 3 ");//groupConfig );
-
                SetSize(300,50);
                _outSizer = new wxFlexGridSizer ( 1, 10, 10);
                _orientation = theOrientation;
                initializeResolutionSlider();
                _actualInstant=new std::map<std::string,int>();
-               
                wxFlexGridSizer * resolutionSizer = new wxFlexGridSizer( 3,1,10,10 );
                resolutionSizer->AddSpacer(10);
                resolutionSizer->Add( _resolutionSlider, 1, wxEXPAND | wxGROW );
                resolutionSizer->AddSpacer(10);
-               
                wxFlexGridSizer * sizer = new wxFlexGridSizer( 1,2,10,10 );
                sizer->Add( _outSizer, 1, wxEXPAND| wxGROW );
                sizer->Add( resolutionSizer, 1, wxEXPAND | wxGROW );
                SetSizer( sizer );
-               Connect( wxID_ANY,  wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxInstantChooserPanel:: onCheckBoxClicked );               
-
+               Connect( wxID_ANY,  wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxInstantChooserPanel:: onCheckBoxClicked );
+        this->Enable(false);
        }
 
        wxInstantChooserPanel ::wxInstantChooserPanel (wxWindow * parent,wxWindowID id ,std::string title, const wxPoint& pos, const wxSize& size , bool theOrientation, std::string configurationElem , std::string groupConfig  )
                _configuration = configurationElem;
                //--- groupConfig -> format: ("## ## # ## "), #:any positive integer number, : space needed between the numbers and at the end of the string.
                setVerticalMaxSelectedNums( groupConfig );
-               
                SetSize(size);
 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
 #if wxMAJOR_VERSION <= 2
                sizer->Add( _outSizer, 1, wxEXPAND| wxGROW );
                sizer->Add( _resolutionSlider, 1, wxEXPAND | wxGROW );
                SetSizer( sizer );
-               Connect( wxID_ANY,  wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxInstantChooserPanel:: onCheckBoxClicked );               
+               Connect( wxID_ANY,  wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxInstantChooserPanel:: onCheckBoxClicked );
+        this->Enable(false);
        }
 
        wxInstantChooserPanel :: ~wxInstantChooserPanel()