Index: sansview/perspectives/fitting/basepage.py
===================================================================
--- sansview/perspectives/fitting/basepage.py	(revision edd166b7701db6213bf2eceec179494a8cda162e)
+++ sansview/perspectives/fitting/basepage.py	(revision 7975f2b5849c8557ad3c09b4c5dc65a79b45a88a)
@@ -7,6 +7,6 @@
 import math
 import string
-from sans.guiframe.utils import format_number,check_float
-from sans.guicomm.events import StatusEvent   
+from sans.guiframe.utils import format_number,check_float,check_value 
+from sans.guicomm.events import StatusEvent
 import pagestate
 from pagestate import PageState
@@ -163,5 +163,5 @@
                      kill_focus_callback = None, set_focus_callback  = None,
                      mouse_up_callback   = None, text_enter_callback = None):
-            
+             
             wx.TextCtrl.__init__(self, parent, id, value, pos, size, style, validator, name)
             
@@ -208,5 +208,5 @@
                     if start==end:
                         control.SetSelection(-1,-1)
-                    
+                 
        
     def onContextMenu(self, event): 
@@ -455,5 +455,5 @@
                     #TODO: total hack - fix this
                     self.state.model= self.model.clone()
-                    #if not hasattr(self.model, "_persistency_dict"):
+
                     self.model._persistency_dict = {}
                     self.model._persistency_dict[p] = [self.values, self.weights]
@@ -499,7 +499,4 @@
 
         self.state.model.name= self.model.name
-        #if not hasattr(self.model, "_persistency_dict"):
-        #self.model._persistency_dict = {}
-        #self.state.model._persistency_dict= copy.deepcopy(self.model._persistency_dict)
         
         #Remember fit engine_type for fit panel
@@ -508,5 +505,4 @@
         if self.manager !=None:
             self.manager._on_change_engine(engine=self.engine_type)
-                #self.engine_type = self.manager._return_engine_type()
         
             self.state.engine_type = self.engine_type
@@ -820,5 +816,4 @@
                         self.model.set_dispersion(item, disp_model)
                     
-                        #self.model._persistency_dict = {}
                         self.model._persistency_dict[item] = [state.values, state.weights]
                     
@@ -925,8 +920,8 @@
              use : _check_value_enter 
         """
+        # Flag to register when a parameter has changed.      
+        is_modified = False
         #self._undo.Enable(True)
         if self.model !=None:
-            # Flag to register when a parameter has changed.      
-            is_modified = False
             try:
                 is_modified =self._check_value_enter( self.fittable_param ,is_modified)
@@ -940,11 +935,12 @@
             # If qmin and qmax have been modified, update qmin and qmax and 
             # set the is_modified flag to True
-            from sans.guiframe.utils import check_value 
             if check_value( self.qmin, self.qmax):
-                if float(self.qmin.GetValue()) != self.qmin_x:
-                    self.qmin_x = float(self.qmin.GetValue())
+                tempmin = float(self.qmin.GetValue())
+                if tempmin != self.qmin_x:
+                    self.qmin_x = tempmin
                     is_modified = True
-                if float(self.qmax.GetValue()) != self.qmax_x:
-                    self.qmax_x = float(self.qmax.GetValue())
+                tempmax = float(self.qmax.GetValue())
+                if tempmax != self.qmax_x:
+                    self.qmax_x = tempmax
                     is_modified = True
                 self.fitrange = True
@@ -953,6 +949,7 @@
             if self.npts != None:
                 if check_float(self.npts):
-                    if float(self.npts.GetValue()) !=  self.num_points:
-                        self.num_points = float(self.npts.GetValue())
+                    temp_npts = float(self.npts.GetValue())
+                    if temp_npts !=  self.num_points:
+                        self.num_points = temp_npts
                         is_modified = True
                 else:
@@ -965,12 +962,13 @@
                 self.state_change= True
                 self._draw_model() 
-            self.Layout()
-            self.Refresh()
-
+                self._sleep4sec()
+                self.Layout()
+                self.Refresh()
+        return is_modified
+    
     def _update_paramv_on_fit(self):
         """
              make sure that update param values just before the fitting
         """
-        from sans.guiframe.utils import check_value 
         #flag for qmin qmax check values
         flag =False
@@ -985,17 +983,19 @@
 
             # If qmin and qmax have been modified, update qmin and qmax and 
+             # Here we should check whether the boundaries have been modified.
+            # If qmin and qmax have been modified, update qmin and qmax and 
+            # set the is_modified flag to True
             if check_value( self.qmin, self.qmax):
-                if float(self.qmin.GetValue()) != self.qmin_x:
-                    self.qmin_x = float(self.qmin.GetValue())
-
-                if float(self.qmax.GetValue()) != self.qmax_x:
-                    self.qmax_x = float(self.qmax.GetValue())
+                tempmin = float(self.qmin.GetValue())
+                if tempmin != self.qmin_x:
+                    self.qmin_x = tempmin
+                tempmax = float(self.qmax.GetValue())
+                if tempmax != self.qmax_x:
+                    self.qmax_x = tempmax
                 flag = True
-                
-            if self.npts != None:
-                if check_float(self.npts):
-                    if float(self.npts.GetValue()) !=  self.num_points:
-                        self.num_points = float(self.npts.GetValue())
+            else:
+                flag = False
         else:
+            flag = False
             msg= "Cannot Fit :Must select a model!!!  "
             wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
@@ -1231,5 +1231,4 @@
                 if self.enable_smearer.GetValue():
                     temp_smear= self.smearer
-           
             self.manager.draw_model(self.model, data=self.data,
                                     smearer= temp_smear,
@@ -1400,4 +1399,31 @@
      
         return 0
+    
+    def _onparamEnter(self,event):
+        """ 
+            when enter value on panel redraw model according to changed
+        """
+        tcrtl= event.GetEventObject()
+        
+        #Clear msg if previously shown.
+        msg= ""
+        wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
+        
+        ## save current state
+        self.save_current_state()
+        if event !=None:
+            #self._undo.Enable(True)
+            event = PageInfoEvent(page = self)
+            wx.PostEvent(self.parent, event)
+              
+        if check_float(tcrtl):
+            
+            self._onparamEnter_helper()
+            event.Skip()
+        else:
+            msg= "Cannot Plot :Must enter a number!!!  "
+            wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
+            event.Skip()
+            return 
    
    
@@ -1447,39 +1473,7 @@
         self.disp_list =self.model.getDispParamList()
         self.state.disp_list = self.disp_list
-        #self.sizer4_4.Layout()
-        self.Layout()
-        #self.SetScrollbars(20,20,25,65)
-        #self.Refresh()
-        
-       
-        
-    def _onparamEnter(self,event):
-        """ 
-            when enter value on panel redraw model according to changed
-        """
-
-        tcrtl= event.GetEventObject()
-        
-        #Clear msg if previously shown.
-        msg= ""
-        wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
-        
-        ## save current state
-        self.save_current_state()
-        if event !=None:
-            #self._undo.Enable(True)
-            event = PageInfoEvent(page = self)
-            wx.PostEvent(self.parent, event)
+        self.Layout()     
+        
               
-        if check_float(tcrtl):
-            
-            self._onparamEnter_helper()
-        
-        else:
-            msg= "Cannot Plot :Must enter a number!!!  "
-            wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
-            return 
-        
-        
     def _check_value_enter(self, list, modified):
         """
@@ -1491,5 +1485,4 @@
         if len(list)==0:
             return is_modified
-        
         for item in list:
             #skip angle parameters for 1D
@@ -1504,10 +1497,15 @@
                 param_min= None
                 param_max= None
-
+               
                 ## check minimun value
                 if item[5]!= None and item[5]!= "":
                     if item[5].GetValue().lstrip().rstrip()!="":
                         try:
+                            
                             param_min = float(item[5].GetValue())
+                            if check_value(item[2],item[5]):
+                                if numpy.isfinite(param_min):
+                                    item[2].SetValue(format_number(param_min))
+                            item[2].SetBackgroundColour(wx.WHITE)        
                         except:
                             msg = "Wrong Fit parameter range entered "
@@ -1516,8 +1514,12 @@
                         is_modified = True
                 ## check maximum value
-                if item[6]!= None and item[5]!= "":
+                if item[6]!= None and item[6]!= "":
                     if item[6].GetValue().lstrip().rstrip()!="":
-                        try:
+                        try:                          
                             param_max = float(item[6].GetValue())
+                            if check_value(item[6],item[2]):
+                                if numpy.isfinite(param_max):
+                                    item[2].SetValue(format_number(param_max))  
+                            item[2].SetBackgroundColour(wx.WHITE)               
                         except:
                             msg = "Wrong Fit parameter range entered "
@@ -1525,5 +1527,5 @@
                             raise ValueError, msg
                         is_modified = True
-                from sans.guiframe.utils import check_value
+                
 
                 if param_min != None and param_max !=None:
@@ -1532,19 +1534,18 @@
                         msg+= "name %s of model %s "%(name, self.model.name)
                         wx.PostEvent(self.parent.parent, StatusEvent(status = msg))
-  
+                
                 if name in self.model.details.keys():   
-                    if  param_min != self.model.details[name][1] or param_max != self.model.details[name][2]:
                         self.model.details[name][1:3]= param_min,param_max
                         is_modified = True
-    
+              
                 else:
-                    self.model.details [name] = ["",param_min,param_max] 
-                    is_modified = True
-            
+                        self.model.details [name] = ["",param_min,param_max] 
+                        is_modified = True
+                
             value= float(item[2].GetValue())
   
             # If the value of the parameter has changed,
             # +update the model and set the is_modified flag
-            if value != self.model.getParam(name):
+            if value != self.model.getParam(name) and numpy.isfinite(value):
                 self.model.setParam(name,value)
                 is_modified = True   
@@ -1645,9 +1646,6 @@
             self.save_current_state()
             self.sizer4_4.Clear(True)
-            #self.sizer4_4.Layout()
-            #self.sizer4.Layout()
             self.Layout()
-            #self.Refresh()
-            #self.SetScrollbars(20,20,25,65)   
+ 
             return 
         if (len(self.disp_cb_dict)>0) :
@@ -1663,15 +1661,10 @@
 
                     pass
-                # Redraw the model
-                #self._draw_model()
+
         ## save state into
         self.save_current_state()
-        #self.sizer4_4.Layout()
-        #self.sizer4.Layout()
-        self.Layout()
-        #self.SetScrollbars(20,20,25,65)    
+        self.Layout()  
         self.Refresh()
-        
-            
+                  
             
     def _on_select_Disp(self,event):
@@ -1683,5 +1676,4 @@
         name = self.disp_box.GetValue()
         dispersity= self.disp_box.GetClientData(n)
-        
         self.disp_name = name
         
@@ -1698,9 +1690,7 @@
         wx.PostEvent(self.parent, event)
         
-        #self.sizer4_4.Layout()
-        #self.sizer4.Layout()
-        #self.Layout()
+        self.sizer4_4.Layout()
+        self.sizer4.Layout()
         self.SetScrollbars(20,20,25,65)
-        #self.Refresh()
         
     def _set_sizer_arraydispersion(self):
@@ -1747,5 +1737,4 @@
                 self.state.disp_cb_dict[p]=  self.disp_cb_dict[p].GetValue()
                 self.Bind(wx.EVT_RADIOBUTTON, self.select_disp_angle, id=self.disp_cb_dict[p].GetId())
-                #wx.EVT_RADIOBUTTON(self, self.disp_cb_dict[p].GetId(), self.select_disp_angle)
                 self.sizer4_4.Add(self.disp_cb_dict[p], (iy, ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
         
@@ -1757,10 +1746,7 @@
                 if not (self.enable2D or self.data.__class__.__name__ =="Data2D"):
                     self.disp_cb_dict[p].Hide()
-                    #self.disp_cb_dict[p].Disable()
                 else:
                     self.disp_cb_dict[p].Show(True)
-                    #self.disp_cb_dict[p].Enable()
                 self.Bind(wx.EVT_RADIOBUTTON, self.select_disp_angle, id=self.disp_cb_dict[p].GetId())
-                #wx.EVT_RADIOBUTTON(self, self.disp_cb_dict[p].GetId(), self.select_disp_angle)
                 self.sizer4_4.Add(self.disp_cb_dict[p], (iy, ix), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
 
@@ -1769,9 +1755,5 @@
         iy +=1 
         self.sizer4_4.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)        
-        #self.sizer4_4.Layout()
-        #self.sizer4.Layout()
         self.Layout()
-        #self.SetScrollbars(20,20,25,65)
-        ## save state into
 
         self.state.orientation_params =[]
@@ -1815,20 +1797,15 @@
             boxsizer1 = box_sizer
 
-        self.qmin    = BasicPage.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20),style=wx.TE_PROCESS_ENTER)
+        self.qmin    = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20),style=wx.TE_PROCESS_ENTER)
         self.qmin.SetValue(str(self.qmin_x))
         self.qmin.SetToolTipString("Minimun value of Q in linear scale.")
-        #self.qmin.Bind(wx.EVT_SET_FOCUS, self.onSetFocus)
-        #self.qmin.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter)
-        #self.qmin.Bind(wx.EVT_TEXT_ENTER, self._onparamEnter)
      
-        self.qmax    = BasicPage.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20),style=wx.TE_PROCESS_ENTER)
+        self.qmax    = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20),style=wx.TE_PROCESS_ENTER)
         self.qmax.SetValue(str(self.qmax_x))
         self.qmax.SetToolTipString("Maximum value of Q in linear scale.")
-        #self.qmax.Bind(wx.EVT_SET_FOCUS, self.onSetFocus)
-        #self.qmax.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter)
-        #self.qmax.Bind(wx.EVT_TEXT_ENTER, self._onparamEnter)
         
         id = wx.NewId()
         self.reset_qrange =wx.Button(self,id,'Reset',size=(70,23))
+      
         self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked,id=id)
         self.reset_qrange.SetToolTipString("Reset Q range to the default values")
@@ -1857,7 +1834,5 @@
         self.sizer5.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
         self.sizer5.Layout()
-        #self.Layout()
-        #self.SetScrollbars(20,20,25,65)
-    
+
     
     def _fill_save_sizer(self):
@@ -1887,5 +1862,22 @@
         self.sizer6.Layout()
         self.SetScrollbars(20,20,25,65)
-
+        
+    def _lay_out(self):
+        """
+            returns self.Layout
+            Note: Mac seems to like this better when self.Layout is called after fitting.
+        """
+        self._sleep4sec()
+        self.Layout()
+        self._sleep4sec()
+        return 
+    
+    def _sleep4sec(self):
+        """
+        sleep for 0.5 sec only on Mac
+        """
+        if ON_MAC == True:
+            time.sleep(0.5)
+             
     def on_reset_clicked(self,event):
         """
@@ -1907,5 +1899,6 @@
             self.num_points = _NPTS_DEFAULT            
             self.state.npts = self.num_points
-        
+            
+
         self.state.qmin = self.qmin_x
         self.state.qmax = self.qmax_x
Index: sansview/perspectives/fitting/fitpage.py
===================================================================
--- sansview/perspectives/fitting/fitpage.py	(revision edd166b7701db6213bf2eceec179494a8cda162e)
+++ sansview/perspectives/fitting/fitpage.py	(revision 7975f2b5849c8557ad3c09b4c5dc65a79b45a88a)
@@ -7,9 +7,10 @@
 import copy
 import math
+import time
 from sans.models.dispersion_models import ArrayDispersion, GaussianDispersion
 
 from sans.guicomm.events import StatusEvent   
-from sans.guiframe.utils import format_number,check_float
-
+from sans.guiframe.utils import format_number,check_float,check_value
+ 
 ## event to post model to fit to fitting plugins
 (ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent()
@@ -33,6 +34,8 @@
   
     """
+    
     def __init__(self,parent, page_info):
         BasicPage.__init__(self, parent, page_info)
+
         """ 
             Initialization of the Panel
@@ -92,4 +95,5 @@
                 self.text2_min.Hide()
                 self.text2_max.Hide()
+
             else:
                 item[5].Show(True)
@@ -138,6 +142,6 @@
                     item[6].Show(True)
         self.Layout()
-        
-    
+        self.Refresh()
+
     def _fill_range_sizer(self):
         """
@@ -188,6 +192,5 @@
         #Set sizer for Fitting section
         self._set_range_sizer( title=title,box_sizer=boxsizer_range, object1=sizer_smearer, object= sizer_fit)
-  
-       
+
     def _fill_datainfo_sizer(self):
         """
@@ -267,5 +270,4 @@
 
     
-    #def _set_sizer_gaussian(self):
     def _set_sizer_dispersion(self, dispersity):
         """
@@ -354,5 +356,5 @@
                         ix = 1
                         value= self.model.getParam(name1)
-                        ctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
+                        ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
                                             style=wx.TE_PROCESS_ENTER)
                         ctl1.SetValue(str (format_number(value)))
@@ -373,8 +375,7 @@
 
                         ix = 4
-                        ctl3 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
+                        ctl3 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
                                                        kill_focus_callback = self._onparamRangeEnter,
-                                                       text_enter_callback = self._onparamRangeEnter,
-                                                       set_focus_callback  = self._onparamRangeEnter)
+                                                       text_enter_callback = self._onparamRangeEnter)
 
                         self.sizer4_4.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -382,8 +383,7 @@
                 
                         ix = 5
-                        ctl4 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
+                        ctl4 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
                                                        kill_focus_callback = self._onparamRangeEnter,
-                                                       text_enter_callback = self._onparamRangeEnter,
-                                                       set_focus_callback  = self._onparamRangeEnter)
+                                                       text_enter_callback = self._onparamRangeEnter)
                         self.sizer4_4.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
 
@@ -400,5 +400,5 @@
                             ix = 6
                             value= self.model.getParam(name2)
-                            Tctl = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
+                            Tctl = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
                                                 style=wx.TE_PROCESS_ENTER)
                             
@@ -411,5 +411,5 @@
                             ix = 7
                             value= self.model.getParam(name3)
-                            Tct2 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
+                            Tct2 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
                                                 style=wx.TE_PROCESS_ENTER)
                             Tct2.SetValue(str (format_number(value)))
@@ -452,5 +452,5 @@
                         ix = 1
                         value= self.model.getParam(name1)
-                        ctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
+                        ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
                                             style=wx.TE_PROCESS_ENTER)
                         ctl1.SetValue(str (format_number(value)))
@@ -474,8 +474,7 @@
                             
                         ix = 4
-                        ctl3 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
+                        ctl3 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
                                                        kill_focus_callback = self._onparamRangeEnter,
-                                                       text_enter_callback = self._onparamRangeEnter,
-                                                       set_focus_callback  = self._onparamRangeEnter)
+                                                       text_enter_callback = self._onparamRangeEnter)
 
                         self.sizer4_4.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -484,8 +483,7 @@
                 
                         ix = 5
-                        ctl4 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
+                        ctl4 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
                                                        kill_focus_callback = self._onparamRangeEnter,
-                                                       text_enter_callback = self._onparamRangeEnter,
-                                                       set_focus_callback  = self._onparamRangeEnter)
+                                                       text_enter_callback = self._onparamRangeEnter)
                         self.sizer4_4.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
                         ctl4.Hide()
@@ -509,5 +507,5 @@
                             ix = 6
                             value= self.model.getParam(name2)
-                            Tctl = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
+                            Tctl = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
                                                 style=wx.TE_PROCESS_ENTER)
                             
@@ -526,5 +524,5 @@
                             ix = 7
                             value= self.model.getParam(name3)
-                            Tct2 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
+                            Tct2 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
                                                 style=wx.TE_PROCESS_ENTER)
                             Tct2.SetValue(str (format_number(value)))
@@ -536,6 +534,5 @@
                                                wx.EXPAND|wx.ADJUST_MINSIZE, 0)
                             ix +=1
-                            #self.sizer4_4.Add((20,20), (iy,ix),(1,1),
-                                               #wx.EXPAND|wx.ADJUST_MINSIZE, 0)
+
                             self.fixed_param.append([None,name3, Tct2
                                                      ,None,None, None, None,None])    
@@ -564,18 +561,14 @@
         ix =0 
         iy +=1 
-        #self.sizer4_4.Layout()
-        #self.sizer4.Layout()
+
         self.Layout()
-        #self.SetScrollbars(20,20,25,65)
-        #self.Refresh()
-     
-        
+
+
     def _onFit(self, event):     
         """
             Allow to fit
         """
-        from sans.guiframe.utils import check_value
-        self.select_param(event =None)
         #make sure all parameter values are updated.
+       
         flag = self._update_paramv_on_fit() #check_value( self.qmin, self.qmax) 
                 
@@ -589,4 +582,7 @@
             wx.PostEvent(self.parent.parent, StatusEvent(status= msg ))
             return 
+      
+
+        self.select_param(event =None)
         
         #Clear errors if exist from previous fitting
@@ -610,5 +606,5 @@
         #    self.btFit.SetLabel("Fit")
         #    self.btFit.Bind(event= wx.EVT_BUTTON, handler=self._onFit, id=self.btFit.GetId())
-        self.btFit.SetFocus()    
+           
 
         
@@ -622,9 +618,5 @@
         self.btFit.Unbind(event=wx.EVT_BUTTON, id=self.btFit.GetId())
         self.btFit.Bind(event=wx.EVT_BUTTON, handler=self._onFit,id=self.btFit.GetId())
-       
-            
-        #self.btFit.SetFocus()    
-        #self.sizer5.Layout()
-        #self.SetScrollbars(20,20,55,40)    
+        
             
     def _on_select_model(self, event): 
@@ -675,25 +667,28 @@
             when enter value on panel redraw model according to changed
         """
+        flag = False
         tcrtl= event.GetEventObject()
+
         #Clear msg if previously shown.
         msg= ""
         wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
-        
+
         if check_float(tcrtl):
-            self._onparamEnter_helper()
-            temp_smearer = None
-            if self.enable_smearer.GetValue():
-                temp_smearer= self.smearer
-            self.compute_chisqr(smearer= temp_smearer)
-
-            ## new state posted
-            if self.state_change:
-                #self._undo.Enable(True)
-                self.save_current_state()
-                event = PageInfoEvent(page = self)
-                wx.PostEvent(self.parent, event)
+            flag = self._onparamEnter_helper()
+            if flag:
+                temp_smearer = None
+                if self.enable_smearer.GetValue():
+                    temp_smearer= self.smearer
+                self.compute_chisqr(smearer= temp_smearer)
+    
+                ## new state posted
+                if self.state_change:
+                    #self._undo.Enable(True)
+                    event = PageInfoEvent(page = self)
+                    wx.PostEvent(self.parent, event)
                 self.state_change= False
- 
+            self.save_current_state()
         else:
+            self.save_current_state()
             msg= "Cannot Plot :Must enter a number!!!  "
             wx.PostEvent(self.parent.parent, StatusEvent(status = msg ))
@@ -718,5 +713,4 @@
                 self._check_value_enter(self.fittable_param ,is_modified)
                 self._check_value_enter(self.parameters ,is_modified) 
-
             except:
                 tcrtl.SetBackgroundColour("pink")
@@ -732,6 +726,7 @@
         wx.PostEvent(self.parent, event)
         self.state_change= False
+        self._sleep4sec()
         self.Layout()
-        self.Refresh()                
+        #self.Refresh()                
 
        
@@ -759,5 +754,5 @@
                 if item[4]!=None and item[4].IsShown():                   
                     item[4].Hide()
-                    
+  
         if len(self.fittable_param)>0:
             for item in self.fittable_param:
@@ -774,5 +769,4 @@
                 if item[4]!=None and item[4].IsShown():
                     item[4].Hide()
-        
         return        
                 
@@ -787,7 +781,4 @@
         self.state.data= data 
         self._fill_datainfo_sizer()
-
-        #self.SetScrollbars(20,20,25,65)
-        #self.Layout()   
         
     def reset_page(self, state,first=False):
@@ -802,10 +793,9 @@
         if self.engine_type != None:
             self.manager._on_change_engine(engine=self.engine_type)
-        #self.tcChi.SetLabel(str(format_number(self.tcChi.GetLabel())))  
-        # reset param_toFit   
+
         self.select_param(event = None) 
         #Save state_fit
         self.save_current_state_fit()
-        self.Layout()
+        self._lay_out()
         self.Refresh()
         
@@ -815,4 +805,24 @@
         """
         return float(self.qmin_x) , float(self.qmax_x)
+    
+    def get_npts2fit(self):
+        """
+            return numbers of data points within qrange
+            Note: This is for Park where chi2 is not normalized by Npts of fit
+        """
+        npts2fit = 0
+        qmin,qmax = self.get_range()
+        if self.data.__class__.__name__ =="Data2D":
+            for qx in self.data.x_bins:
+                for qy in self.data.y_bins:
+                   if math.sqrt((qx*qx)+(qy*qy)) >= qmin \
+                         and math.sqrt((qx*qx)+(qy*qy)) <= qmax:
+                       npts2fit += 1
+        else:
+            for qx in self.data.x:
+                   if qx >= qmin and qx <= qmax:
+                       npts2fit += 1
+        return npts2fit
+
 
     def get_chi2(self):
@@ -848,8 +858,19 @@
         is_modified = False
         has_error = False    
+        
+        #Hide textctrl boxes of errors.
         self._clear_Err_on_Fit()    
+        
+        #Check if chi2 is finite
+        if chisqr != None or numpy.isfinite(chisqr):
         #format chi2
-        chi2 = format_number(chisqr)
-        self.tcChi.SetLabel(chi2)
+            npt_fit = float(self.get_npts2fit())   
+            if self.engine_type == "park" and npt_fit > 0:   
+                chisqr =chisqr/npt_fit    
+            chi2 = format_number(chisqr)    
+            self.tcChi.SetLabel(chi2)    
+            self.tcChi.Refresh()    
+        else:
+            self.tcChi.SetLabel("-")
         
         #Hide error title
@@ -860,13 +881,14 @@
             n = self.disp_box.GetCurrentSelection()
             dispersity= self.disp_box.GetClientData(n)
-            name= dispersity.__name__
-            if name == "GaussianDispersion":
-                if hasattr(self,"text_disp_1" ):
-                    if self.text_disp_1 !=None:
-                        self.text_disp_1.Hide()
+            if dispersity !=None and self.enable_disp.GetValue():
+                name= dispersity.__name__
+                if name == "GaussianDispersion":
+                    if hasattr(self,"text_disp_1" ):
+                        if self.text_disp_1 !=None:
+                            self.text_disp_1.Hide()
         except:
+            dispersty = None
             pass
         #set the panel when fit result are float not list
-
         if out.__class__== numpy.float64:
             self.param_toFit[0][2].SetValue(format_number(out))
@@ -877,9 +899,10 @@
                 self.text2_3.Show(True)
                 try:
-                    name= dispersity.__name__
-                    if name == "GaussianDispersion":
-                        if hasattr(self,"text_disp_1" ):
-                            if self.text_disp_1 !=None:
-                                self.text_disp_1.Show(True)
+                    if dispersity !=None:
+                        name= dispersity.__name__
+                        if name == "GaussianDispersion" and self.enable_disp.GetValue():
+                            if hasattr(self,"text_disp_1" ):
+                                if self.text_disp_1 !=None:
+                                    self.text_disp_1.Show(True)
                 except:
                     pass
@@ -888,11 +911,8 @@
                     if self.param_toFit[0][3].IsShown:
                         self.param_toFit[0][3].Hide()
-                else:
-                    
-                    self.param_toFit[0][3].Show(True)
-                    self.param_toFit[0][3].Refresh()                 
+                else:                    
+                    self.param_toFit[0][3].Show(True)               
                     self.param_toFit[0][4].Show(True)
                     self.param_toFit[0][4].SetValue(format_number(cov[0]))
-                    self.param_toFit[0][4].Refresh()
                     has_error = True
         else:
@@ -900,40 +920,39 @@
             i = 0
             #Set the panel when fit result are list
-            for item in self.param_toFit:      
+            for item in self.param_toFit:     
                 if len(item)>5 and item != None:     
                     ## reset error value to initial state
-                    if item[3].IsShown():
-                        item[3].Hide()
-                    if item[4].IsShown():
-                        item[4].Hide()
-  
-                    if len(out)<=len(self.param_toFit):# and i < len(out):
-                        val_out = format_number(self.model.getParam(item[1]))
-                        if item[2] != val_out:
-                            item[2].SetValue(val_out)
-                       
+                    item[3].Hide()
+                    item[4].Hide()
+                    
                     for ind in range(len(out)):
                         
                         if item[1] == p_name[ind]:
                             break        
-
-                    if(cov !=None) and len(cov)<=len(self.param_toFit):
+                    if len(out)<=len(self.param_toFit) and out[ind] !=None:   
+                        val_out = format_number(out[ind])                  
+                        item[2].SetValue(val_out)
+
+                    if(cov !=None):
                         
                         try:
-                            name= dispersity.__name__
-                            if name == "GaussianDispersion":
-                                if hasattr(self,"text_disp_1" ):
-                                    if self.text_disp_1!=None:
-                                        self.text_disp_1.Show(True)
+                            if dispersity !=None:
+                                name= dispersity.__name__
+                                if name == "GaussianDispersion" and self.enable_disp.GetValue():
+                                    if hasattr(self,"text_disp_1" ):
+                                        if self.text_disp_1!=None:
+                                            if not self.text_disp_1.IsShown():
+                                                self.text_disp_1.Show(True)
                         except:
                             pass    
                    
-                        if cov[ind]!=None and numpy.isfinite(cov[ind]):
-                            val_err = format_number(cov[ind])
-                            item[3].Show(True)
-                            item[4].Show(True)
-                            if val_err != item[4].GetValue():
-                                item[4].SetValue(format_number(cov[ind]))
-                            has_error = True
+                        if cov[ind]!=None :
+                            if numpy.isfinite(float(cov[ind])):
+                                val_err = format_number(cov[ind])
+                                item[3].Show(True)
+                                item[4].Show(True)
+                                item[4].SetValue(val_err)
+
+                                has_error = True
             	    i += 1         
         #Show error title when any errors displayed
@@ -941,13 +960,14 @@
             if not self.text2_3.IsShown():
                 self.text2_3.Show(True) 
-        try:      
-            ## save current state  
-            self.save_current_state() 
-            self.Layout()
-            self.Refresh()
-        except:
-            raise
-        self.btFit.SetFocus()  
-
+                
+        ## save current state  
+        self.save_current_state()          
+        #plot model
+        self._draw_model()   
+        self._lay_out()      
+        #PostStatusEvent     
+        msg="Fit completed! "
+        wx.PostEvent(self.manager.parent, StatusEvent(status=msg))
+      
 
     def onSmear(self, event):
@@ -995,5 +1015,4 @@
            
             self.sizer5.Layout()
-            self.sizer5.Refresh()
             self.state.tcChi =self.tcChi
           
@@ -1006,10 +1025,4 @@
             Compute chisqr for 1D
         """
-        from sans.guiframe.utils import check_value
-        flag = check_value( self.qmin, self.qmax)
-        
-        if not flag:
-            return 
-        
         try:
             self.qmin_x = float(self.qmin.GetValue())
@@ -1043,9 +1056,4 @@
             to the tcChi txtcrl
         """
-        from sans.guiframe.utils import check_value
-        flag = check_value( self.qmin, self.qmax)
-        if not flag:
-            return 
-      
         try:
             self.qmin_x = float(self.qmin.GetValue())
@@ -1076,5 +1084,4 @@
             to the tcChi txtcrl
         """
-        from sans.guiframe.utils import check_value
         flag = check_value( self.qmin, self.qmax)
         if flag== True:
@@ -1281,5 +1288,5 @@
                 ix += 1
                 value= self.model.getParam(item)
-                ctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
+                ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
                                     style=wx.TE_PROCESS_ENTER)
                 
@@ -1298,8 +1305,7 @@
                 
                 ix += 1
-                ctl3 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
+                ctl3 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
                                                kill_focus_callback = self._onparamRangeEnter,
-                                               text_enter_callback = self._onparamRangeEnter,
-                                               set_focus_callback  = self._onparamRangeEnter)
+                                               text_enter_callback = self._onparamRangeEnter)
      
                 sizer.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -1307,8 +1313,7 @@
         
                 ix += 1
-                ctl4 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
+                ctl4 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
                                                kill_focus_callback = self._onparamRangeEnter,
-                                               text_enter_callback = self._onparamRangeEnter,
-                                               set_focus_callback  = self._onparamRangeEnter)
+                                               text_enter_callback = self._onparamRangeEnter)
                 sizer.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
       
@@ -1320,7 +1325,7 @@
                 ix +=1
                 # Units
-                try:
+                if self.model.details.has_key(item):
                     units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
-                except:
+                else:
                     units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
                 sizer.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -1376,5 +1381,5 @@
                     ix += 1
                     value= self.model.getParam(item)
-                    ctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
+                    ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
                                         style=wx.TE_PROCESS_ENTER)
                     
@@ -1399,8 +1404,7 @@
                     
                     ix += 1
-                    ctl3 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
+                    ctl3 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
                                                    kill_focus_callback = self._onparamRangeEnter,
-                                                   text_enter_callback = self._onparamRangeEnter,
-                                                   set_focus_callback  = self._onparamRangeEnter)
+                                                   text_enter_callback = self._onparamRangeEnter)
                
                     sizer.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -1413,8 +1417,7 @@
                 
                     ix += 1
-                    ctl4 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
+                    ctl4 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20), style=wx.TE_PROCESS_ENTER,
                                                    kill_focus_callback = self._onparamRangeEnter,
-                                                   text_enter_callback = self._onparamRangeEnter,
-                                                   set_focus_callback  = self._onparamRangeEnter)
+                                                   text_enter_callback = self._onparamRangeEnter)
                     sizer.Add(ctl4, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
                    
@@ -1427,7 +1430,7 @@
                     ix +=1
                     # Units
-                    try:
+                    if self.model.details.has_key(item):
                         units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
-                    except:
+                    else:
                         units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
                     if self.data.__class__.__name__ =="Data2D":
@@ -1438,6 +1441,5 @@
                     
                     sizer.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
-                        
-                    
+                                          
                     ##[cb state, name, value, "+/-", error of fit, min, max , units]
                     self.parameters.append([cb,item, ctl1,
@@ -1447,13 +1449,10 @@
               
         iy+=1
-        #sizer.Add((10,10),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         
         #Display units text on panel
         for item in keys:   
-            if self.model.details[item][0]!='':
+            if self.model.details.has_key(item):
                 self.text2_4.Show()
-                break
-            else:
-                self.text2_4.Hide()
+
         #self.state.cb1 = self.cb1.GetValue()        
         #self._copy_parameters_state(self.orientation_params,
Index: sansview/perspectives/fitting/fitting.py
===================================================================
--- sansview/perspectives/fitting/fitting.py	(revision edd166b7701db6213bf2eceec179494a8cda162e)
+++ sansview/perspectives/fitting/fitting.py	(revision 7975f2b5849c8557ad3c09b4c5dc65a79b45a88a)
@@ -477,13 +477,16 @@
             ## If a thread is already started, stop it
             if self.calc_fit!= None and self.calc_fit.isrunning():
+                return
                 self.calc_fit.stop()
             
             wx.PostEvent(self.parent, StatusEvent(status="Start the computation",
                                         curr_thread=self.calc_fit,type="start"))
+            time.sleep(0.5)
             wx.PostEvent(self.parent, StatusEvent(status="Computing...",
                                         curr_thread=self.calc_fit,type="progress"))
+            time.sleep(0.5)
             ## perform single fit
             if self._fit_engine=="scipy":
-                qmin, qmax= self.current_pg.get_range()
+                #qmin, qmax= self.current_pg.get_range()
                 self.calc_fit=FitThread(parent =self.parent,
                                         fn= self.fitter,
@@ -745,8 +748,5 @@
             @param qmax: the maximum value of x to replot model
           
-        """
-        wx.PostEvent(self.parent, StatusEvent(status="Single fit \
-        complete! " ))
-      
+        """     
         try:
             if result ==None:
@@ -766,12 +766,7 @@
             for name in pars:
                 param_name.append(name)
-                if result.pvec.__class__==numpy.float64:
-                    model.setParam(name,result.pvec)
-                else:
-                    if result.pvec[i] != None and numpy.isfinite(result.pvec[i]):
-                        model.setParam(name,result.pvec[i])
-                    i += 1
-            ## Reset values of the current page to fit result
+
             cpage.onsetValues(result.fitness,param_name, result.pvec,result.stderr)
+            """
             ## plot the current model with new param
             metadata =  self.page_finder[cpage].get_fit_data()
@@ -784,5 +779,5 @@
             self.draw_model( model=model, data= metadata, smearer= smearer,
                              qmin= qmin, qmax= qmax)
-            wx.PostEvent(self.parent, StatusEvent(status=" " , type="stop")) 
+            """
         except:
             msg= "Single Fit completed but Following error occurred:%s"% sys.exc_value
@@ -798,6 +793,4 @@
             @param elapsed: computation time
         """
-        wx.PostEvent(self.parent, StatusEvent(status="Simultaneous fit complete "))
-       
         ## fit more than 1 model at the same time 
         try:
@@ -816,6 +809,4 @@
                 if format_number(result.fitness) == page.get_chi2():
                     #ToDo: Compare parameter inputs with outputs too.
-                    msg= "Simultaneous Fit completed"
-                    msg +=" but chi2 has not been improved..."
                     wx.PostEvent(self.parent, StatusEvent(status="%s " % msg)) 
                     break     
@@ -833,25 +824,12 @@
                         if model.name == model_name:
                             p_name= model.name+"."+param_name
-                            if p.name == p_name:
-                                small_out.append(p.value )
+                            if p.name == p_name:      
                                 if p.value != None and numpy.isfinite(p.value):
-                                    model.setParam(param_name,p.value) 
-                                small_param_name.append(param_name)
-                                small_cov.append(p.stderr)
-                            else:
-                                value= model.getParam(param_name)
-                                small_out.append(value )
-                                small_param_name.append(param_name)
-                                small_cov.append(None)
+                                    small_out.append(p.value )
+                                    small_param_name.append(param_name)
+                                    small_cov.append(p.stderr)
+
                     # Display result on each page 
                     page.onsetValues(result.fitness, small_param_name,small_out,small_cov)
-                    #Replot models
-                    msg= "Simultaneous Fit completed. plotting... %s:"%model.name
-                    wx.PostEvent(self.parent, StatusEvent(status="%s " % msg))
-                    qmin, qmax= page.get_range()
-                    smearer =self.page_finder[page].get_smearer()
-                    self.draw_model( model=model, data= metadata, smearer=smearer,
-                                     qmin= qmin, qmax= qmax)
-            wx.PostEvent(self.parent, StatusEvent(status=msg, type="stop"))
         except:
              msg= "Simultaneous Fit completed"
Index: sansview/perspectives/fitting/modelpage.py
===================================================================
--- sansview/perspectives/fitting/modelpage.py	(revision c99a6c514c56374f21266b358ae99f1145058839)
+++ sansview/perspectives/fitting/modelpage.py	(revision 7975f2b5849c8557ad3c09b4c5dc65a79b45a88a)
@@ -90,5 +90,5 @@
 
         sizer_npts= wx.GridSizer(1, 1,5, 5)    
-        self.npts    = BasicPage.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
+        self.npts    = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
         self.npts.SetValue(format_number(self.num_points))
         self.npts.SetToolTipString("Number of point to plot.")
@@ -186,5 +186,5 @@
                         ix = 1
                         value= self.model.getParam(name1)
-                        ctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
+                        ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
                                             style=wx.TE_PROCESS_ENTER)
                         ctl1.SetValue(str (format_number(value)))
@@ -195,5 +195,5 @@
                             ix =2
                             value= self.model.getParam(name2)
-                            Tctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
+                            Tctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
                                                 style=wx.TE_PROCESS_ENTER)
                             Tctl1.SetValue(str (format_number(value)))
@@ -205,5 +205,5 @@
                             ix =3 
                             value= self.model.getParam(name3)
-                            Tctl2 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
+                            Tctl2 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
                                                 style=wx.TE_PROCESS_ENTER)
                             Tctl2.SetValue(str (format_number(value)))
@@ -234,5 +234,5 @@
                         ix = 1
                         value= self.model.getParam(name1)
-                        ctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
+                        ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
                                             style=wx.TE_PROCESS_ENTER)
                         ctl1.SetValue(str (format_number(value)))
@@ -251,5 +251,5 @@
                             ix =2
                             value= self.model.getParam(name2)
-                            Tctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
+                            Tctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
                                                 style=wx.TE_PROCESS_ENTER)
                             Tctl1.SetValue(str (format_number(value)))
@@ -269,5 +269,5 @@
                             ix =3 
                             value= self.model.getParam(name3)
-                            Tctl2 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
+                            Tctl2 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
                                                 style=wx.TE_PROCESS_ENTER)
                             Tctl2.SetValue(str (format_number(value)))
@@ -412,7 +412,8 @@
         
         self.model_description = wx.Button(self,-1, label="Details", size=(80,23))
+        
         self.model_description.Bind(wx.EVT_BUTTON,self.on_button_clicked)
         self.model_description.SetToolTipString("Click Model Functions in HelpWindow...")
-      
+        self.model_description.SetFocus()
         sizer_selection.Add( self.description_show )
         sizer_selection.Add( (20,20)) 
@@ -528,5 +529,5 @@
                 ix += 1
                 value= self.model.getParam(item)
-                ctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
+                ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
                     style=wx.TE_PROCESS_ENTER)
                 
@@ -536,7 +537,7 @@
                 ix +=1
                 # Units
-                try:
+                if self.model.details.has_key(item):
                     units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
-                except:
+                else:
                     units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
                 sizer.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -574,5 +575,5 @@
                 ix += 1
                 value= self.model.getParam(item)
-                ctl1 = BasicPage.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
+                ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
                     style=wx.TE_PROCESS_ENTER)
                 
@@ -588,14 +589,12 @@
                 ix +=1
                 # Units
-                try:
+                if self.model.details.has_key(item):
                     units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
-                except:
+                else:
                     units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
                 if not self.enable2D:
                     units.Hide()
-                    #units.Disable()
                 else:
                     units.Show(True)
-                    #units.Enable()
    
                 sizer.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
@@ -611,13 +610,9 @@
                     
         iy+=1
-        #sizer.Add((10,10),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
         
         #Display units text on panel
         for item in keys:   
-            if self.model.details[item][0]!='':
-                self.text2_4.Show()
-                break
-            else:
-                self.text2_4.Hide()
+            self.text2_4.Show()
+
       
         boxsizer1.Add(sizer)
