Index: src/sas/perspectives/fitting/fitpage.py
===================================================================
--- src/sas/perspectives/fitting/fitpage.py	(revision 098f3d277d54e6ae4bae35ed0188be84b67fb171)
+++ src/sas/perspectives/fitting/fitpage.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -93,5 +93,6 @@
         fill sizer 0 with data info
         """
-        self.data_box_description = wx.StaticBox(self, -1, 'I(q) Data Source')
+        self.data_box_description = wx.StaticBox(self, wx.ID_ANY,
+                                                 'I(q) Data Source')
         if check_data_validity(self.data):
             dname_color = wx.BLUE
@@ -102,8 +103,8 @@
         #----------------------------------------------------------
         sizer_data = wx.BoxSizer(wx.HORIZONTAL)
-        self.dataSource = wx.ComboBox(self, -1, style=wx.CB_READONLY)
-        wx.EVT_COMBOBOX(self.dataSource, -1, self.on_select_data)
+        self.dataSource = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)
+        wx.EVT_COMBOBOX(self.dataSource, wx.ID_ANY, self.on_select_data)
         self.dataSource.SetMinSize((_DATA_BOX_WIDTH, -1))
-        sizer_data.Add(wx.StaticText(self, -1, 'Name : '))
+        sizer_data.Add(wx.StaticText(self, wx.ID_ANY, 'Name : '))
         sizer_data.Add(self.dataSource)
         sizer_data.Add((0, 5))
@@ -221,5 +222,5 @@
 
         #Sizers
-        box_description_range = wx.StaticBox(self, -1, str(title))
+        box_description_range = wx.StaticBox(self, wx.ID_ANY, str(title))
         box_description_range.SetForegroundColour(wx.BLUE)
         boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL)
@@ -229,9 +230,10 @@
         self.sizer_set_masking = wx.BoxSizer(wx.HORIZONTAL)
         sizer_chi2 = wx.BoxSizer(wx.VERTICAL)
-        smear_set_box = wx.StaticBox(self, -1, 'Set Instrumental Smearing')
+        smear_set_box = wx.StaticBox(self, wx.ID_ANY,
+                                     'Set Instrumental Smearing')
         sizer_smearer_box = wx.StaticBoxSizer(smear_set_box, wx.HORIZONTAL)
         sizer_smearer_box.SetMinSize((_DATA_BOX_WIDTH, 60))
 
-        weighting_set_box = wx.StaticBox(self, -1, \
+        weighting_set_box = wx.StaticBox(self, wx.ID_ANY,
                                 'Set Weighting by Selecting dI Source')
         weighting_box = wx.StaticBoxSizer(weighting_set_box, wx.HORIZONTAL)
@@ -239,9 +241,9 @@
         weighting_box.SetMinSize((_DATA_BOX_WIDTH, 40))
         #Filling the sizer containing weighting info.
-        self.dI_noweight = wx.RadioButton(self, -1, 'No Weighting',
-                                          style=wx.RB_GROUP)
-        self.dI_didata = wx.RadioButton(self, -1, 'Use dI Data')
-        self.dI_sqrdata = wx.RadioButton(self, -1, 'Use |sqrt(I Data)|')
-        self.dI_idata = wx.RadioButton(self, -1, 'Use |I Data|')
+        self.dI_noweight = wx.RadioButton(self, wx.ID_ANY,
+                                          'No Weighting', style=wx.RB_GROUP)
+        self.dI_didata = wx.RadioButton(self, wx.ID_ANY, 'Use dI Data')
+        self.dI_sqrdata = wx.RadioButton(self, wx.ID_ANY, 'Use |sqrt(I Data)|')
+        self.dI_idata = wx.RadioButton(self, wx.ID_ANY, 'Use |I Data|')
         self.Bind(wx.EVT_RADIOBUTTON, self.onWeighting,
                   id=self.dI_noweight.GetId())
@@ -269,16 +271,17 @@
 
         # combobox for smear2d accuracy selection
-        self.smear_accuracy = wx.ComboBox(self, -1, size=(50, -1),
-                                          style=wx.CB_READONLY)
+        self.smear_accuracy = wx.ComboBox(self, wx.ID_ANY,
+                                          size=(50, -1), style=wx.CB_READONLY)
         self._set_accuracy_list()
         self.smear_accuracy.SetValue(self.smear2d_accuracy)
         self.smear_accuracy.SetSelection(0)
-        self.smear_accuracy.SetToolTipString(\
+        self.smear_accuracy.SetToolTipString(
             "'Higher' uses more Gaussian points for smearing computation.")
 
-        wx.EVT_COMBOBOX(self.smear_accuracy, -1, self._on_select_accuracy)
+        wx.EVT_COMBOBOX(self.smear_accuracy, wx.ID_ANY,
+                        self._on_select_accuracy)
 
         #Fit button
-        self.btFit = wx.Button(self, wx.NewId(), 'Fit')
+        self.btFit = wx.Button(self, self._ids.next(), 'Fit')
         self.default_bt_colour = self.btFit.GetDefaultAttributes()
         self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id=self.btFit.GetId())
@@ -286,5 +289,5 @@
 
         #General Help button
-        self.btFitHelp = wx.Button(self, -1, 'Help')
+        self.btFitHelp = wx.Button(self, wx.ID_ANY, 'Help')
         self.btFitHelp.SetToolTipString("General fitting help.")
         self.btFitHelp.Bind(wx.EVT_BUTTON, self._onFitHelp)
@@ -299,23 +302,23 @@
         else:
             size_q = (30, 20)  #on MAC
-        self.btSmearHelp = wx.Button(self, -1, '?', style=wx.BU_EXACTFIT,\
-                                     size=size_q)
+        self.btSmearHelp = wx.Button(self, wx.ID_ANY, '?',
+                                     style=wx.BU_EXACTFIT, size=size_q)
         self.btSmearHelp.SetToolTipString("Resolution smearing help.")
         self.btSmearHelp.Bind(wx.EVT_BUTTON, self._onSmearHelp)
         
         #textcntrl for custom resolution
-        self.smear_pinhole_max = ModelTextCtrl(self, -1,
+        self.smear_pinhole_max = ModelTextCtrl(self, wx.ID_ANY,
                             size=(_BOX_WIDTH - 25, 20),
                             style=wx.TE_PROCESS_ENTER,
                             text_enter_callback=self.onPinholeSmear)
-        self.smear_pinhole_min = ModelTextCtrl(self, -1,
+        self.smear_pinhole_min = ModelTextCtrl(self, wx.ID_ANY,
                             size=(_BOX_WIDTH - 25, 20),
                             style=wx.TE_PROCESS_ENTER,
                             text_enter_callback=self.onPinholeSmear)
-        self.smear_slit_height = ModelTextCtrl(self, -1,
+        self.smear_slit_height = ModelTextCtrl(self, wx.ID_ANY,
                             size=(_BOX_WIDTH - 25, 20),
                             style=wx.TE_PROCESS_ENTER,
                             text_enter_callback=self.onSlitSmear)
-        self.smear_slit_width = ModelTextCtrl(self, -1,
+        self.smear_slit_width = ModelTextCtrl(self, wx.ID_ANY,
                             size=(_BOX_WIDTH - 25, 20),
                             style=wx.TE_PROCESS_ENTER,
@@ -323,8 +326,8 @@
 
         ## smear
-        self.smear_data_left = BGTextCtrl(self, -1,
+        self.smear_data_left = BGTextCtrl(self, wx.ID_ANY,
                                           size=(_BOX_WIDTH - 25, 20), style=0)
         self.smear_data_left.SetValue(str(self.dq_l))
-        self.smear_data_right = BGTextCtrl(self, -1,
+        self.smear_data_right = BGTextCtrl(self, wx.ID_ANY,
                                            size=(_BOX_WIDTH - 25, 20), style=0)
         self.smear_data_right.SetValue(str(self.dq_r))
@@ -337,15 +340,14 @@
 
         #Filling the sizer containing instruments smearing info.
-        self.disable_smearer = wx.RadioButton(self, -1,
+        self.disable_smearer = wx.RadioButton(self, wx.ID_ANY,
                                               'None', style=wx.RB_GROUP)
-        self.enable_smearer = wx.RadioButton(self, -1,
-                                             'Use dQ Data')
+        self.enable_smearer = wx.RadioButton(self, wx.ID_ANY, 'Use dQ Data')
         #self.enable_smearer.SetToolTipString(
         #"Click to use the loaded dQ data for smearing.")
-        self.pinhole_smearer = wx.RadioButton(self, -1,
+        self.pinhole_smearer = wx.RadioButton(self, wx.ID_ANY,
                                               'Custom Pinhole Smear')
         #self.pinhole_smearer.SetToolTipString
         #("Click to input custom resolution for pinhole smearing.")
-        self.slit_smearer = wx.RadioButton(self, -1, 'Custom Slit Smear')
+        self.slit_smearer = wx.RadioButton(self, wx.ID_ANY, 'Custom Slit Smear')
         #self.slit_smearer.SetToolTipString
         #("Click to input custom resolution for slit smearing.")
@@ -368,11 +370,10 @@
 
         # StaticText for chi2, N(for fitting), Npts + Log/linear spacing
-        self.tcChi = BGTextCtrl(self, -1, "-", size=(75, 20), style=0)
+        self.tcChi = BGTextCtrl(self, wx.ID_ANY, "-", size=(75, 20), style=0)
         self.tcChi.SetToolTipString("Chi2/Npts(Fit)")
-        self.Npts_fit = BGTextCtrl(self, -1, "-", size=(75, 20), style=0)
-        self.Npts_fit.SetToolTipString(\
+        self.Npts_fit = BGTextCtrl(self, wx.ID_ANY, "-", size=(75, 20), style=0)
+        self.Npts_fit.SetToolTipString(
                             " Npts : number of points selected for fitting")
-        self.Npts_total = ModelTextCtrl(self, -1,
-                            size=(_BOX_WIDTH, 20),
+        self.Npts_total = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20),
                             style=wx.TE_PROCESS_ENTER,
                             text_enter_callback=self._onQrangeEnter)
@@ -382,55 +383,55 @@
 
         # Update and Draw button
-        self.draw_button = wx.Button(self, wx.NewId(), 'Compute')
-        self.draw_button.Bind(wx.EVT_BUTTON, \
+        self.draw_button = wx.Button(self, self._ids.next(), 'Compute')
+        self.draw_button.Bind(wx.EVT_BUTTON,
                               self._onDraw, id=self.draw_button.GetId())
         self.draw_button.SetToolTipString("Compute and Draw.")
 
         self.points_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.pointsbox = wx.CheckBox(self, -1, 'Log?', (10, 10))
+        self.pointsbox = wx.CheckBox(self, wx.ID_ANY, 'Log?', (10, 10))
         self.pointsbox.SetValue(False)
         self.pointsbox.SetToolTipString("Check mark to use log spaced points")
         wx.EVT_CHECKBOX(self, self.pointsbox.GetId(), self.select_log)
 
-        self.points_sizer.Add(wx.StaticText(self, -1, 'Npts    '))
+        self.points_sizer.Add(wx.StaticText(self, wx.ID_ANY, 'Npts    '))
         self.points_sizer.Add(self.pointsbox)
 
-        box_description_1 = wx.StaticText(self, -1, '   Chi2/Npts')
-        box_description_2 = wx.StaticText(self, -1, 'Npts(Fit)')
+        box_description_1 = wx.StaticText(self, wx.ID_ANY, '   Chi2/Npts')
+        box_description_2 = wx.StaticText(self, wx.ID_ANY, 'Npts(Fit)')
 
         # StaticText for smear
-        self.smear_description_none = wx.StaticText(self, -1,
+        self.smear_description_none = wx.StaticText(self, wx.ID_ANY,
                                     smear_message_none, style=wx.ALIGN_LEFT)
-        self.smear_description_dqdata = wx.StaticText(self,
-                                - 1, smear_message_dqdata, style=wx.ALIGN_LEFT)
-        self.smear_description_type = wx.StaticText(self,
-                                     - 1, "Type:", style=wx.ALIGN_LEFT)
-        self.smear_description_accuracy_type = wx.StaticText(self, -1,
-                                        "Accuracy:", style=wx.ALIGN_LEFT)
-        self.smear_description_smear_type = BGTextCtrl(self, -1,
+        self.smear_description_dqdata = wx.StaticText(self, wx.ID_ANY,
+                                 smear_message_dqdata, style=wx.ALIGN_LEFT)
+        self.smear_description_type = wx.StaticText(self, wx.ID_ANY,
+                                    "Type:", style=wx.ALIGN_LEFT)
+        self.smear_description_accuracy_type = wx.StaticText(self, wx.ID_ANY,
+                                    "Accuracy:", style=wx.ALIGN_LEFT)
+        self.smear_description_smear_type = BGTextCtrl(self, wx.ID_ANY,
                                                        size=(57, 20), style=0)
         self.smear_description_smear_type.SetValue(str(self.dq_l))
         self.SetBackgroundColour(self.GetParent().GetBackgroundColour())
-        self.smear_description_2d = wx.StaticText(self, -1,
+        self.smear_description_2d = wx.StaticText(self, wx.ID_ANY,
                                     smear_message_2d, style=wx.ALIGN_LEFT)
-        self.smear_message_new_s = wx.StaticText(self, -1,
+        self.smear_message_new_s = wx.StaticText(self, wx.ID_ANY,
                          smear_message_new_ssmear, style=wx.ALIGN_LEFT)
-        self.smear_message_new_p = wx.StaticText(self, -1,
+        self.smear_message_new_p = wx.StaticText(self, wx.ID_ANY,
                             smear_message_new_psmear, style=wx.ALIGN_LEFT)
-        self.smear_description_2d_x = wx.StaticText(self, -1,
+        self.smear_description_2d_x = wx.StaticText(self, wx.ID_ANY,
                             smear_message_2d_x_title, style=wx.ALIGN_LEFT)
-        self.smear_description_2d_x.SetToolTipString(\
+        self.smear_description_2d_x.SetToolTipString(
                                         "  dQp(parallel) in q_r direction.")
-        self.smear_description_2d_y = wx.StaticText(self, -1,
+        self.smear_description_2d_y = wx.StaticText(self, wx.ID_ANY,
                             smear_message_2d_y_title, style=wx.ALIGN_LEFT)
         self.smear_description_2d_y.SetToolTipString(\
                                     " dQs(perpendicular) in q_phi direction.")
-        self.smear_description_pin_min = wx.StaticText(self, -1,
+        self.smear_description_pin_min = wx.StaticText(self, wx.ID_ANY,
                         smear_message_pinhole_min_title, style=wx.ALIGN_LEFT)
-        self.smear_description_pin_max = wx.StaticText(self, -1,
+        self.smear_description_pin_max = wx.StaticText(self, wx.ID_ANY,
                         smear_message_pinhole_max_title, style=wx.ALIGN_LEFT)
-        self.smear_description_slit_height = wx.StaticText(self, -1,
+        self.smear_description_slit_height = wx.StaticText(self, wx.ID_ANY,
                         smear_message_slit_height_title, style=wx.ALIGN_LEFT)
-        self.smear_description_slit_width = wx.StaticText(self, -1,
+        self.smear_description_slit_width = wx.StaticText(self, wx.ID_ANY,
                         smear_message_slit_width_title, style=wx.ALIGN_LEFT)
 
@@ -519,5 +520,5 @@
         self.sizer5.Clear(True)
 
-        self.qmin = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
+        self.qmin = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20),
                                   style=wx.TE_PROCESS_ENTER,
                                   set_focus_callback=self.qrang_set_focus,
@@ -530,5 +531,5 @@
         self.qmin.SetToolTipString(qmin_tip)
 
-        self.qmax = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
+        self.qmax = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20),
                                   style=wx.TE_PROCESS_ENTER,
                                   set_focus_callback=self.qrang_set_focus,
@@ -545,5 +546,5 @@
         self.qmin.Bind(wx.EVT_TEXT, self.on_qrange_text)
         self.qmax.Bind(wx.EVT_TEXT, self.on_qrange_text)
-        wx_id = wx.NewId()
+        wx_id = self._ids.next()
         self.reset_qrange = wx.Button(self, wx_id, 'Reset')
 
@@ -553,13 +554,13 @@
         sizer = wx.GridSizer(5, 5, 2, 6)
 
-        self.btEditMask = wx.Button(self, wx.NewId(), 'Editor')
+        self.btEditMask = wx.Button(self, self._ids.next(), 'Editor')
         self.btEditMask.Bind(wx.EVT_BUTTON, self._onMask,
                              id=self.btEditMask.GetId())
         self.btEditMask.SetToolTipString("Edit Mask.")
-        self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)')
-
-        sizer.Add(wx.StaticText(self, -1, '   Q range'))
-        sizer.Add(wx.StaticText(self, -1, ' Min[1/A]'))
-        sizer.Add(wx.StaticText(self, -1, ' Max[1/A]'))
+        self.EditMask_title = wx.StaticText(self, wx.ID_ANY, ' Masking(2D)')
+
+        sizer.Add(wx.StaticText(self, wx.ID_ANY, '   Q range'))
+        sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Min[1/A]'))
+        sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Max[1/A]'))
         sizer.Add(self.EditMask_title)
         sizer.Add((-1,5))
@@ -618,5 +619,5 @@
 
         ## fill a sizer with the combobox to select dispersion type
-        model_disp = wx.StaticText(self, -1, 'Function')
+        model_disp = wx.StaticText(self, wx.ID_ANY, 'Function')
         CHECK_STATE = self.cb1.GetValue()
         import sas.models.dispersion_models
@@ -625,9 +626,9 @@
         ix = 0
         iy = 0
-        disp = wx.StaticText(self, -1, ' ')
+        disp = wx.StaticText(self, wx.ID_ANY, ' ')
         self.sizer4_4.Add(disp, (iy, ix), (1, 1),
                           wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
         ix += 1
-        values = wx.StaticText(self, -1, 'PD[ratio]')
+        values = wx.StaticText(self, wx.ID_ANY, 'PD[ratio]')
         polytext = "Polydispersity (= STD/mean); "
         polytext += "the standard deviation over the mean value."
@@ -641,20 +642,20 @@
         else:
             err_text = ''
-        self.text_disp_1 = wx.StaticText(self, -1, err_text)
+        self.text_disp_1 = wx.StaticText(self, wx.ID_ANY, err_text)
         self.sizer4_4.Add(self.text_disp_1, (iy, ix), (1, 1), \
                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
 
         ix += 1
-        self.text_disp_min = wx.StaticText(self, -1, 'Min')
+        self.text_disp_min = wx.StaticText(self, wx.ID_ANY, 'Min')
         self.sizer4_4.Add(self.text_disp_min, (iy, ix), (1, 1), \
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
 
         ix += 1
-        self.text_disp_max = wx.StaticText(self, -1, 'Max')
+        self.text_disp_max = wx.StaticText(self, wx.ID_ANY, 'Max')
         self.sizer4_4.Add(self.text_disp_max, (iy, ix), (1, 1),
                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
 
         ix += 1
-        npts = wx.StaticText(self, -1, 'Npts')
+        npts = wx.StaticText(self, wx.ID_ANY, 'Npts')
         npts.SetToolTipString("Number of sampling points for the numerical\n\
         integration over the distribution function.")
@@ -662,5 +663,5 @@
                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
-        nsigmas = wx.StaticText(self, -1, 'Nsigs')
+        nsigmas = wx.StaticText(self, wx.ID_ANY, 'Nsigs')
         nsigmas.SetToolTipString("Number of sigmas between which the range\n\
          of the distribution function will be used for weighting. \n\
@@ -695,5 +696,5 @@
                     if p == "width":
                         ix = 0
-                        cb = wx.CheckBox(self, -1, name0, (10, 10))
+                        cb = wx.CheckBox(self, wx.ID_ANY, name0, (10, 10))
                         cb.SetValue(CHECK_STATE)
                         cb.SetToolTipString("Check mark to fit")
@@ -703,5 +704,5 @@
                         ix = 1
                         value = self.model.getParam(name1)
-                        ctl1 = ModelTextCtrl(self, -1,
+                        ctl1 = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 1.3, 20),
                                              style=wx.TE_PROCESS_ENTER)
@@ -715,5 +716,5 @@
                         ## text to show error sign
                         ix = 2
-                        text2 = wx.StaticText(self, -1, '+/-')
+                        text2 = wx.StaticText(self, wx.ID_ANY, '+/-')
                         self.sizer4_4.Add(text2, (iy, ix), (1, 1),
                                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
@@ -722,5 +723,5 @@
 
                         ix = 3
-                        ctl2 = wx.TextCtrl(self, -1,
+                        ctl2 = wx.TextCtrl(self, wx.ID_ANY,
                                            size=(_BOX_WIDTH / 1.3, 20),
                                            style=0)
@@ -732,5 +733,5 @@
 
                         ix = 4
-                        ctl3 = ModelTextCtrl(self, -1,
+                        ctl3 = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 2, 20),
                                              style=wx.TE_PROCESS_ENTER,
@@ -741,5 +742,5 @@
 
                         ix = 5
-                        ctl4 = ModelTextCtrl(self, -1,
+                        ctl4 = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 2, 20),
                                              style=wx.TE_PROCESS_ENTER,
@@ -755,5 +756,5 @@
                         ix = 6
                         value = self.model.getParam(name2)
-                        Tctl = ModelTextCtrl(self, -1,
+                        Tctl = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 2.2, 20),
                                              style=wx.TE_PROCESS_ENTER)
@@ -767,5 +768,5 @@
                         ix = 7
                         value = self.model.getParam(name3)
-                        Tct2 = ModelTextCtrl(self, -1,
+                        Tct2 = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 2.2, 20),
                                              style=wx.TE_PROCESS_ENTER)
@@ -779,5 +780,5 @@
 
                 ix = 8
-                disp_box = wx.ComboBox(self, -1, size=(65, -1),
+                disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1),
                                        style=wx.CB_READONLY, name='%s' % name1)
                 for key, value in self.polydisp.iteritems():
@@ -785,5 +786,5 @@
                     disp_box.Append(name_disp, value)
                     disp_box.SetStringSelection("gaussian")
-                wx.EVT_COMBOBOX(disp_box, -1, self._on_disp_func)
+                wx.EVT_COMBOBOX(disp_box, wx.ID_ANY, self._on_disp_func)
                 self.sizer4_4.Add(disp_box, (iy, ix), (1, 1), wx.EXPAND)
                 self.fittable_param.append([cb, name1, ctl1, text2,
@@ -815,5 +816,5 @@
                     if p == "width":
                         ix = 0
-                        cb = wx.CheckBox(self, -1, name0, (10, 10))
+                        cb = wx.CheckBox(self, wx.ID_ANY, name0, (10, 10))
                         cb.SetValue(CHECK_STATE)
                         cb.SetToolTipString("Check mark to fit")
@@ -828,5 +829,5 @@
                         ix = 1
                         value = self.model.getParam(name1)
-                        ctl1 = ModelTextCtrl(self, -1,
+                        ctl1 = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 1.3, 20),
                                              style=wx.TE_PROCESS_ENTER)
@@ -854,5 +855,5 @@
                         ## text to show error sign
                         ix = 2
-                        text2 = wx.StaticText(self, -1, '+/-')
+                        text2 = wx.StaticText(self, wx.ID_ANY, '+/-')
                         self.sizer4_4.Add(text2, (iy, ix), (1, 1),
                                           wx.EXPAND | wx.ADJUST_MINSIZE, 0)
@@ -861,5 +862,5 @@
 
                         ix = 3
-                        ctl2 = wx.TextCtrl(self, -1,
+                        ctl2 = wx.TextCtrl(self, wx.ID_ANY,
                                            size=(_BOX_WIDTH / 1.3, 20),
                                            style=0)
@@ -876,5 +877,5 @@
 
                         ix = 4
-                        ctl3 = ModelTextCtrl(self, -1,
+                        ctl3 = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 2, 20),
                                              style=wx.TE_PROCESS_ENTER,
@@ -887,5 +888,5 @@
 
                         ix = 5
-                        ctl4 = ModelTextCtrl(self, -1,
+                        ctl4 = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 2, 20),
                                              style=wx.TE_PROCESS_ENTER,
@@ -903,5 +904,5 @@
                         ix = 6
                         value = self.model.getParam(name2)
-                        Tctl = ModelTextCtrl(self, -1,
+                        Tctl = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 2.2, 20),
                                              style=wx.TE_PROCESS_ENTER)
@@ -923,5 +924,5 @@
                         ix = 7
                         value = self.model.getParam(name3)
-                        Tct2 = ModelTextCtrl(self, -1,
+                        Tct2 = ModelTextCtrl(self, wx.ID_ANY,
                                              size=(_BOX_WIDTH / 2.2, 20),
                                              style=wx.TE_PROCESS_ENTER)
@@ -943,5 +944,5 @@
 
                 ix = 8
-                disp_box = wx.ComboBox(self, -1, size=(65, -1),
+                disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1),
                                 style=wx.CB_READONLY, name='%s' % name1)
                 for key, value in self.polydisp.iteritems():
@@ -949,5 +950,5 @@
                     disp_box.Append(name_disp, value)
                     disp_box.SetStringSelection("gaussian")
-                wx.EVT_COMBOBOX(disp_box, -1, self._on_disp_func)
+                wx.EVT_COMBOBOX(disp_box, wx.ID_ANY, self._on_disp_func)
                 self.sizer4_4.Add(disp_box, (iy, ix), (1, 1), wx.EXPAND)
                 self.fittable_param.append([cb, name1, ctl1, text2,
@@ -1079,5 +1080,5 @@
 
         _TreeLocation = "user/perspectives/fitting/fitting_help.html"
-        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",
+        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "",
                                           "General Fitting Help")
 
@@ -1098,5 +1099,5 @@
 
         _TreeLocation = "user/perspectives/fitting/sm_help.html"
-        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",
+        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "",
                                           "Instrumental Resolution Smearing \
                                           Help")
@@ -1182,6 +1183,10 @@
             self._keep.Enable(False)
             self._set_save_flag(False)
+        # TODO: why do we have to variables for one flag??
         self.enable_disp.SetValue(False)
         self.disable_disp.SetValue(True)
+        # TODO: should not have an untrapped exception when displaying disperser
+        # TODO: do we need to create the disperser panel on every model change?
+        # Note: if we fix this, then remove ID_DISPERSER_HELP from basepage
         try:
             self.set_dispers_sizer()
@@ -2831,5 +2836,5 @@
             return
 
-        box_description = wx.StaticBox(self, -1, str("Model Parameters"))
+        box_description = wx.StaticBox(self, wx.ID_ANY, str("Model Parameters"))
         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         sizer = wx.GridBagSizer(5, 5)
@@ -2898,5 +2903,5 @@
         ix = 0
         select_text = "Select All"
-        self.cb1 = wx.CheckBox(self, -1, str(select_text), (10, 10))
+        self.cb1 = wx.CheckBox(self, wx.ID_ANY, str(select_text), (10, 10))
         wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param)
         self.cb1.SetToolTipString("To check/uncheck all the boxes below.")
@@ -2906,9 +2911,9 @@
                              wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5)
         ix += 1
-        self.text2_2 = wx.StaticText(self, -1, 'Value')
+        self.text2_2 = wx.StaticText(self, wx.ID_ANY, 'Value')
         sizer.Add(self.text2_2, (iy, ix), (1, 1), \
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 2
-        self.text2_3 = wx.StaticText(self, -1, 'Error')
+        self.text2_3 = wx.StaticText(self, wx.ID_ANY, 'Error')
         sizer.Add(self.text2_3, (iy, ix), (1, 1), \
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
@@ -2916,15 +2921,15 @@
             self.text2_3.Hide()
         ix += 1
-        self.text2_min = wx.StaticText(self, -1, 'Min')
+        self.text2_min = wx.StaticText(self, wx.ID_ANY, 'Min')
         sizer.Add(self.text2_min, (iy, ix), (1, 1), \
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         #self.text2_min.Hide()
         ix += 1
-        self.text2_max = wx.StaticText(self, -1, 'Max')
+        self.text2_max = wx.StaticText(self, wx.ID_ANY, 'Max')
         sizer.Add(self.text2_max, (iy, ix), (1, 1), \
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         #self.text2_max.Hide()
         ix += 1
-        self.text2_4 = wx.StaticText(self, -1, '[Units]')
+        self.text2_4 = wx.StaticText(self, wx.ID_ANY, '[Units]')
         sizer.Add(self.text2_4, (iy, ix), (1, 1), \
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
@@ -2947,5 +2952,5 @@
                     self.temp_multi_functional)\
                     and (item in self.model.non_fittable):
-                    non_fittable_name = wx.StaticText(self, -1, item)
+                    non_fittable_name = wx.StaticText(self, wx.ID_ANY, item)
                     sizer.Add(non_fittable_name, (iy, ix), (1, 1), \
                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 21)
@@ -2955,5 +2960,5 @@
                     if len(self.model.fun_list) > 0:
                         #num = item.split('_')[1][5:7]
-                        fun_box = wx.ComboBox(self, -1, size=(100, -1),
+                        fun_box = wx.ComboBox(self, wx.ID_ANY, size=(100, -1),
                                     style=wx.CB_READONLY, name='%s' % item)
                         self._set_fun_box_list(fun_box)
@@ -2961,7 +2966,7 @@
                         #self.fun_box.SetToolTipString("A function
                         #    describing the interface")
-                        wx.EVT_COMBOBOX(fun_box, -1, self._on_fun_box)
+                        wx.EVT_COMBOBOX(fun_box, wx.ID_ANY, self._on_fun_box)
                     else:
-                        fun_box = ModelTextCtrl(self, -1,
+                        fun_box = ModelTextCtrl(self, wx.ID_ANY,
                                                 size=(_BOX_WIDTH, 20),
                                 style=wx.TE_PROCESS_ENTER, name='%s' % item)
@@ -2975,5 +2980,5 @@
                 else:
                     ## add parameters name with checkbox for selecting to fit
-                    cb = wx.CheckBox(self, -1, item)
+                    cb = wx.CheckBox(self, wx.ID_ANY, item)
                     cb.SetValue(CHECK_STATE)
                     cb.SetToolTipString(" Check mark to fit.")
@@ -2987,5 +2992,5 @@
                     ix += 1
                     value = self.model.getParam(item)
-                    ctl1 = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),
+                    ctl1 = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20),
                                          style=wx.TE_PROCESS_ENTER)
                     ctl1.SetToolTipString(\
@@ -2995,5 +3000,5 @@
                     ## text to show error sign
                     ix += 1
-                    text2 = wx.StaticText(self, -1, '+/-')
+                    text2 = wx.StaticText(self, wx.ID_ANY, '+/-')
                     sizer.Add(text2, (iy, ix), (1, 1), \
                               wx.EXPAND | wx.ADJUST_MINSIZE, 0)
@@ -3001,5 +3006,5 @@
                         text2.Hide()
                     ix += 1
-                    ctl2 = wx.TextCtrl(self, -1,
+                    ctl2 = wx.TextCtrl(self, wx.ID_ANY,
                                        size=(_BOX_WIDTH / 1.2, 20), style=0)
                     sizer.Add(ctl2, (iy, ix), (1, 1),
@@ -3009,5 +3014,5 @@
 
                     ix += 1
-                    ctl3 = ModelTextCtrl(self, -1,
+                    ctl3 = ModelTextCtrl(self, wx.ID_ANY,
                                          size=(_BOX_WIDTH / 1.9, 20),
                                          style=wx.TE_PROCESS_ENTER,
@@ -3021,5 +3026,5 @@
 
                     ix += 1
-                    ctl4 = ModelTextCtrl(self, -1,
+                    ctl4 = ModelTextCtrl(self, wx.ID_ANY,
                                          size=(_BOX_WIDTH / 1.9, 20),
                                          style=wx.TE_PROCESS_ENTER,
@@ -3034,8 +3039,8 @@
                     # Units
                     if item in self.model.details:
-                        units = wx.StaticText(self, -1,
+                        units = wx.StaticText(self, wx.ID_ANY,
                             self.model.details[item][0], style=wx.ALIGN_LEFT)
                     else:
-                        units = wx.StaticText(self, -1, "",
+                        units = wx.StaticText(self, wx.ID_ANY, "",
                                               style=wx.ALIGN_LEFT)
                     sizer.Add(units, (iy, ix), (1, 1),
@@ -3060,11 +3065,11 @@
         for item in keys:
             if item in self.model.orientation_params:
-                orient_angle = wx.StaticText(self, -1, '[For 2D only]:')
-                mag_on_button = wx.Button(self, -1, "Magnetic ON")
+                orient_angle = wx.StaticText(self, wx.ID_ANY, '[For 2D only]:')
+                mag_on_button = wx.Button(self, wx.ID_ANY, "Magnetic ON")
                 mag_on_button.SetToolTipString("Turn Pol Beam/Mag scatt on/off")
                 mag_on_button.Bind(wx.EVT_BUTTON, self._on_mag_on)
-                mag_angle_help_button = wx.Button(self, -1, "Magnetic angles?")
+                mag_angle_help_button = wx.Button(self, wx.ID_ANY, "Magnetic angles?")
                 mag_angle_help_button.SetToolTipString("see angle definitions")
-                mag_help_button = wx.Button(self, -1, "Mag HELP")
+                mag_help_button = wx.Button(self, wx.ID_ANY, "Mag HELP")
                 mag_help_button.SetToolTipString("Help on pol beam/mag fitting")
                 mag_help_button.Bind(wx.EVT_BUTTON, self._on_mag_help)
@@ -3124,5 +3129,5 @@
                     ix = 0
                     ## add parameters name with checkbox for selecting to fit
-                    cb = wx.CheckBox(self, -1, item)
+                    cb = wx.CheckBox(self, wx.ID_ANY, item)
                     cb.SetValue(CHECK_STATE)
                     cb.SetToolTipString("Check mark to fit")
