Index: sansview/perspectives/fitting/basepage.py
===================================================================
--- sansview/perspectives/fitting/basepage.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
+++ sansview/perspectives/fitting/basepage.py	(revision ffa69b62cb644c01e4e8c849232fa7eb3bb92209)
@@ -43,19 +43,19 @@
         self.SetWindowVariant(variant=FONT_VARIANT)
         ##window_name
-        self.window_name = page_info.window_name
-        ##window_caption
-        self.window_caption = page_info.window_caption
+       
         ## parent of the page
         self.parent = parent
         ## manager is the fitting plugin
-        self.manager= page_info.manager
+        self.manager= None
         ## owner of the page (fitting plugin)
-        self.event_owner= page_info.event_owner
+        self.event_owner= None
          ## current model
-        self.model = page_info.model
+        self.model = None
         ## data
-        self.data = page_info.data
+        self.data = None
+        self.state = PageState(parent=parent)
         ## dictionary containing list of models
-        self.model_list_box = page_info.model_list_box
+        self.model_list_box = None
+        self.set_page_info(page_info=page_info)
         ## Data member to store the dispersion object created
         self._disp_obj_dict = {}
@@ -79,4 +79,5 @@
         self.disp_list=[]
         self.disp_name=""
+        
         ## list of orientation parameters
         self.orientation_params=[]
@@ -209,5 +210,25 @@
                         control.SetSelection(-1,-1)
                  
-       
+    def set_page_info(self, page_info):
+        """
+            set some page important information at once
+        """
+       ##window_name
+        self.window_name = page_info.window_name
+        ##window_caption
+        self.window_caption = page_info.window_caption
+        ## manager is the fitting plugin
+        self.manager= page_info.manager
+        ## owner of the page (fitting plugin)
+        self.event_owner= page_info.event_owner
+         ## current model
+        self.model = page_info.model
+        ## data
+        self.data = page_info.data
+        ## dictionary containing list of models
+        self.model_list_box = page_info.model_list_box
+        ## Data member to store the dispersion object created
+        self.populate_box(dict=self.model_list_box)
+        
     def onContextMenu(self, event): 
         """
@@ -312,7 +333,31 @@
         self.model_list_box = dict
         self.state.model_list_box = self.model_list_box
-            
-    
-        
+        
+    def initialize_combox(self): 
+        """
+            put default value in the combobox 
+        """  
+        ## fill combox box
+        if self.model_list_box is None:
+            return
+        if len(self.model_list_box)>0:
+            self._populate_box( self.formfactorbox,self.model_list_box["Shapes"])
+       
+        if len(self.model_list_box)>0:
+            self._populate_box( self.structurebox,
+                                self.model_list_box["Structure Factors"])
+            self.structurebox.Insert("None", 0,None)
+            self.structurebox.SetSelection(0)
+            self.structurebox.Hide()
+            self.text2.Hide()
+            self.structurebox.Disable()
+            self.text2.Disable()
+             
+            if self.model.__class__ in self.model_list_box["P(Q)*S(Q)"]:
+                self.structurebox.Show()
+                self.text2.Show()
+                self.structurebox.Enable()
+                self.text2.Enable()            
+                
     def set_dispers_sizer(self):
         """
@@ -728,5 +773,14 @@
         self._copy_parameters_state(self.fixed_param, self.state.fixed_param)
     
-               
+          
+    def check_invalid_panel(self):  
+        """
+            check if the user can already perform some action with this panel
+        """ 
+        flag = False
+        if self.data is None and self.model is None:
+            msg = "Please load a Data to start"
+            wx.MessageBox(msg, 'Info')
+            return  True
     def reset_page_helper(self, state):
         """
@@ -881,4 +935,6 @@
             Reset the plotting range to a given state
         """
+        if self.check_invalid_panel():
+            return
         self.qmin.SetValue(str(state.qmin))
         self.qmax.SetValue(str(state.qmax)) 
@@ -1224,4 +1280,6 @@
             [Note to coder: This way future changes will be done in only one place.] 
         """
+        if self.check_invalid_panel():
+            return
         if self.model !=None:
             temp_smear=None
@@ -1236,7 +1294,5 @@
                                     qstep= float(self.num_points),
                                     enable2D=self.enable2D) 
-        print "_draw_model"
-        for name in self.model.getParamList():
-            print name , self.model.getParam(name)
+       
         
     def _set_model_sizer(self,sizer, box_sizer, title="", object=None):
@@ -1283,33 +1339,14 @@
         
         self.formfactorbox = wx.ComboBox(self, -1,style=wx.CB_READONLY)
-        if self.model!=None:
+        if self.model!= None:
             self.formfactorbox.SetValue(self.model.name)
-            
-            
+           
         self.structurebox = wx.ComboBox(self, -1,style=wx.CB_READONLY)
         wx.EVT_COMBOBOX(self.formfactorbox,-1, self._on_select_model)
         wx.EVT_COMBOBOX(self.structurebox,-1, self._on_select_model)
         
-    
-        ## fill combox box
-        if len(self.model_list_box)>0:
-            self._populate_box( self.formfactorbox,self.model_list_box["Shapes"])
        
-        if len(self.model_list_box)>0:
-            self._populate_box( self.structurebox,
-                                self.model_list_box["Structure Factors"])
-            self.structurebox.Insert("None", 0,None)
-            self.structurebox.SetSelection(0)
-            self.structurebox.Hide()
-            self.text2.Hide()
-            self.structurebox.Disable()
-            self.text2.Disable()
+        self.initialize_combox()
              
-            if self.model.__class__ in self.model_list_box["P(Q)*S(Q)"]:
-                self.structurebox.Show()
-                self.text2.Show()
-                self.structurebox.Enable()
-                self.text2.Enable()            
-        
         ## check model type to show sizer
         if self.model !=None:
@@ -1342,4 +1379,7 @@
             Show combox box associate with type of model selected
         """
+        if self.check_invalid_panel():
+            return
+
         ## Don't want to populate combo box again if the event comes from check box
         if self.shape_rbutton.GetValue()and\
@@ -1661,5 +1701,6 @@
             Redraw the model with the default dispersity (Gaussian)
         """
-        
+        if self.check_invalid_panel():
+            return 
         self._reset_dispersity()
     
@@ -1988,4 +2029,6 @@
         #On 'Reset' button  for Q range clicked
         """
+        if self.check_invalid_panel():
+            return
         ##For 3 different cases: Data2D, Data1D, and theory
         if self.data.__class__.__name__ == "Data2D":
Index: sansview/perspectives/fitting/fitpage.py
===================================================================
--- sansview/perspectives/fitting/fitpage.py	(revision 9237df447dfe19e6369d65d570ce5e86d93a99b3)
+++ sansview/perspectives/fitting/fitpage.py	(revision ffa69b62cb644c01e4e8c849232fa7eb3bb92209)
@@ -55,5 +55,8 @@
         self._fill_range_sizer() 
         #self._on_select_model(event=None)
-        if self.data !=None:
+        if self.data is None:
+            self.formfactorbox.Disable()
+            self.structurebox.Disable()
+        else:
             self.smearer = smear_selection( self.data )
             if self.smearer ==None:
@@ -64,4 +67,5 @@
         self.Bind(EVT_FITTER_TYPE,self._on_engine_change)
         self.Bind(EVT_FIT_STOP,self._on_fit_complete)
+        
 
     def _on_fit_complete(self, event):
@@ -577,5 +581,6 @@
         """
         #make sure all parameter values are updated.
-       
+        if self.check_invalid_panel():
+            return
         flag = self._update_paramv_on_fit() 
                 
@@ -708,5 +713,6 @@
             Check validity of value enter in the parameters range field
         """
-        
+        if self.check_invalid_panel():
+            return
         tcrtl= event.GetEventObject()
         #Clear msg if previously shown.
@@ -740,5 +746,6 @@
             Check validity of value enter in the Q range field
         """
-        
+        if self.check_invalid_panel():
+            return
         tcrtl= event.GetEventObject()
         #Clear msg if previously shown.
@@ -845,5 +852,9 @@
             data_max = ""
             data_name = ""
+            self.formfactorbox.Disable()
+            self.structurebox.Disable()
         else:
+            self.formfactorbox.Enable()
+            self.structurebox.Enable()
             data_name = self.data.name
             #set maximum range for x in linear scale
@@ -862,10 +873,16 @@
         
         self.dataSource.SetValue(data_name)
+        self.qmin_x = data_min
+        self.qmax_x = data_max
         self.minimum_q.SetValue(str(data_min))
         self.maximum_q.SetValue(str(data_max))
-        self.qmin_x = data_min
-        self.qmax_x = data_max
-        self.state.data = data, data_max
-        print "set_data",data_min
+        self.qmin.SetValue(str(data_min))
+        self.qmax.SetValue(str(data_max))
+        self.qmin.SetBackgroundColour("white")
+        self.qmax.SetBackgroundColour("white")
+        self.state.data = data
+        self.state.qmin = self.qmin_x
+        self.state.qmax = self.qmax_x
+        
         
     def reset_page(self, state,first=False):
@@ -1063,4 +1080,6 @@
             are compute when fitting
         """
+        if self.check_invalid_panel():
+            return
         if self.model ==None:
             msg="Need model and data to smear plot"
Index: sansview/perspectives/fitting/fitpanel.py
===================================================================
--- sansview/perspectives/fitting/fitpanel.py	(revision 2377cd44ed9aabd497ffaf99bd7428c98b631179)
+++ sansview/perspectives/fitting/fitpanel.py	(revision ffa69b62cb644c01e4e8c849232fa7eb3bb92209)
@@ -98,9 +98,9 @@
     """
     data = None
-    model= None
-    manager= None
+    model =  None
+    manager = None
     event_owner= None
     model_list_box = None
-    name=None
+    name = None
     ## Internal name for the AUI manager
     window_name = "Page"
@@ -157,10 +157,12 @@
     
         #model page info
-        self.model_page_number=None
+        self.model_page_number = None
         ## fit page number for model plot
-        self.fit_page1D_number=None
-        self.fit_page2D_number=None
-        self.model_page=None
-        self.sim_page=None
+        self.fit_page1D_number = None
+        self.fit_page2D_number = None
+        self.model_page = None
+        self.sim_page = None
+        self.default_page = None
+        self.check_first_data = False
         ## get the state of a page
         self.Bind(basepage.EVT_PAGE_INFO, self._onGetstate)
@@ -172,4 +174,7 @@
         self.hint_page = HintFitPage(self) 
         self.AddPage(page=self.hint_page, caption="Hint")
+        #Add the first fit page
+        self.default_page = self.add_fit_page(data=None)
+        
         # increment number for model name
         self.count=0
@@ -243,5 +248,5 @@
         self.event_owner = owner
     
-    def set_model_list(self,dict):
+    def set_model_list(self, dict):
          """ 
              copy a dictionary of model into its own dictionary
@@ -270,18 +275,19 @@
         return self.sim_page
         
-    def add_fit_page( self,data, reset=False ):
+        
+    def add_fit_page( self,data=None, reset=False ):
         """ 
             Add a fitting page on the notebook contained by fitpanel
             @param data: data to fit
             @return panel : page just added for further used. is used by fitting module
-        """     
-        if data.is_data:
-            name = data.name 
-        else:
-            if data.__class__.__name__=="Data2D":
-                name = 'Model 2D Fit'
+        """    
+        if data is not None:
+            if data.is_data:
+                name = data.name 
             else:
-                name = 'Model 1D Fit'
-        if not name in self.list_fitpage_name:
+                if data.__class__.__name__=="Data2D":
+                    name = 'Model 2D Fit'
+                else:
+                    name = 'Model 1D Fit'
             myinfo = PageInfo( data=data, name=name )
             myinfo.model_list_box = self.model_list_box.get_list()
@@ -291,23 +297,40 @@
             myinfo.window_caption = name
         
-            #if not name in self.fit_page_name :
-            from fitpage import FitPage
-            panel = FitPage(parent= self, page_info=myinfo)
-            
-            self.AddPage(page=panel, caption=name, select=True)
-            if name == 'Model 1D Fit':
-                self.fit_page1D_number= self.GetPageIndex(panel)
-            if name =='Model 2D Fit':
-                self.fit_page2D_number= self.GetPageIndex(panel)
+        else :
+            name = "Fit Page" 
+            myinfo = PageInfo( data=data, name=name )
+        
+        if not name in self.list_fitpage_name:
+            # the first data loading
+            if not self.check_first_data and self.default_page is not None:
+                page_number = self.GetPageIndex(self.default_page)
+                self.SetPageText(page_number , name)
+                self.default_page.set_data(data)
+                self.default_page.set_page_info(page_info=myinfo)
+                self.default_page.initialize_combox()
+                if  data is not None:
+                    self.check_first_data = True
+                panel = self.default_page
+            else:
+                #if not name in self.fit_page_name :
+                from fitpage import FitPage
+                panel = FitPage(parent=self, page_info=myinfo)
                 
-            self.list_fitpage_name.append(name)
-            if reset:
-                if name in self.fit_page_name.keys():
-                    memento= self.fit_page_name[name][0]
-                    panel.reset_page(memento)
-            else:
-                self.fit_page_name[name]=ListOfState()
-                
-                #self.fit_page_name[name].appendItem(panel.createMemento())
+                self.AddPage(page=panel, caption=name, select=True)
+                if name == 'Model 1D Fit':
+                    self.fit_page1D_number= self.GetPageIndex(panel)
+                if name =='Model 2D Fit':
+                    self.fit_page2D_number= self.GetPageIndex(panel)
+                    
+                self.list_fitpage_name.append(name)
+                if data is not None:
+                    if reset:
+                        if name in self.fit_page_name.keys():
+                            memento= self.fit_page_name[name][0]
+                            panel.reset_page(memento)
+                        else:
+                            self.fit_page_name[name]=ListOfState()
+                    
+                    #self.fit_page_name[name].appendItem(panel.createMemento())
             #GetPage(self, page_idx) 
             return panel 
