Index: sasview/sasview.py
===================================================================
--- sasview/sasview.py	(revision 6f3fea20af1759130054b5e4cfa4a251dc06cf52)
+++ sasview/sasview.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -75,6 +75,6 @@
     logging.error("Wx version: error reading version")
 
-#from . import wxcruft
-#wxcruft.call_later_fix()
+from . import wxcruft
+wxcruft.call_later_fix()
 #wxcruft.trace_new_id()
 
Index: sasview/wxcruft.py
===================================================================
--- sasview/wxcruft.py	(revision 2d88fc4a6cc278c2ea7ac05c75e83d324432f287)
+++ sasview/wxcruft.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -15,11 +15,28 @@
 def NewId():
     id = wx._misc.NewId()
-    frame = inspect.stack()[1]
+    path, line, function = _get_caller()
+    if path == "sas/guiframe/utils.py":
+        # Special case: NewId is being called via an IdList request; we
+        # want to which widget triggered the request, not that it was
+        # triggered via IdList.
+        path, line, function = _get_caller(2)
+        tag = " via IdList"
+    elif path.endswith("/wxcruft.py"):
+        # Special case: NewId is being called via CallLater; we want to
+        # know where the CallLater was invoked.
+        path, line, function = _get_caller(1)
+        tag = " via CallLater"
+    else:
+        tag = ""
+    print "NewId %d from %s(%d):%s%s"%(id, path, line, function, tag)
+    return id
+
+def _get_caller(distance=0):
+    frame = inspect.stack()[distance+2]
     path = frame[1]
     index = path.find('/sas/')
     if index == -1: index = path.find('\\sas\\')
-    path = path[index+1:]
-    print "NewId %d from %s(%d):%s"%(id, path, frame[2], frame[3])
-    return id
+    return path[index+1:], frame[2], frame[3]
+
 
 
Index: src/sas/guiframe/gui_toolbar.py
===================================================================
--- src/sas/guiframe/gui_toolbar.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/guiframe/gui_toolbar.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -36,4 +36,5 @@
     Implement toolbar for guiframe
     """
+    ID_BOOKMARK = wx.NewId()
     def __init__(self, parent,  *args, **kwds):
         Tbar.__init__(self, parent,  *args, **kwds)
@@ -133,8 +134,7 @@
         Add default items in bookmark menu
         """
-        id = wx.NewId()
-        self._bookmark_menu.Append(id, 'Bookmark This Page State')
+        self._bookmark_menu.Append(self.ID_BOOKMARK, 'Bookmark This Page State')
         self._bookmark_menu.AppendSeparator()
-        wx.EVT_MENU(self, id, self.on_bookmark)
+        wx.EVT_MENU(self, self.ID_BOOKMARK, self.on_bookmark)
    
     def on_bind_button(self):
Index: src/sas/guiframe/local_perspectives/plotting/Plotter1D.py
===================================================================
--- src/sas/guiframe/local_perspectives/plotting/Plotter1D.py	(revision 2d88fc4a6cc278c2ea7ac05c75e83d324432f287)
+++ src/sas/guiframe/local_perspectives/plotting/Plotter1D.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -19,5 +19,5 @@
 from sas.guiframe.events import StatusEvent
 from sas.guiframe.events import PanelOnFocusEvent
-from sas.guiframe.utils import PanelMenu
+from sas.guiframe.utils import PanelMenu, IdList
 from sas.guiframe.panel_base import PanelBase
 from sas.guiframe.gui_style import GUIFRAME_ICON
@@ -35,17 +35,4 @@
     """return the key of dictionary dic given the value"""
     return [k for k, v in dic.iteritems() if v == val][0]
-
-class IdCollection:
-    def __init__(self):
-        self._ids = []
-        self._index = 0
-    def next(self):
-        if len(self._ids) == self._index:
-           self._ids.append(wx.NewId())
-        self._index += 1
-        return self._ids[self._index-1]
-    def reset(self):
-        self._index = 0
-
 
 class ModelPanel1D(PlotPanel, PanelBase):
@@ -63,5 +50,5 @@
     ## Group ID
     group_id = None
-    _menu_ids = IdCollection()
+    _menu_ids = IdList()
 
     def __init__(self, parent, id=-1, color=None,
@@ -80,5 +67,4 @@
 
         self._available_data = []
-        self._menu_add_ids = []
         self._symbol_labels = self.get_symbol_label()
         self._color_labels = self.get_color_label()
@@ -568,15 +554,15 @@
         self._slicerpop.set_plots(self.plots)
         self._slicerpop.set_graph(self.graph)
-        self._menu_ids.reset()
+        ids = iter(self._menu_ids)
         if not self.graph.selected_plottable in self.plots:
             # Various plot options
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             self._slicerpop.Append(wx_id, '&Save Image', 'Save image as PNG')
             wx.EVT_MENU(self, wx_id, self.onSaveImage)
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             self._slicerpop.Append(wx_id, '&Print Image', 'Print image ')
             wx.EVT_MENU(self, wx_id, self.onPrint)
 
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             self._slicerpop.Append(wx_id, '&Copy to Clipboard',
                                    'Copy to the clipboard')
@@ -595,8 +581,8 @@
                     continue
 
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             plot_menu.Append(wx_id, "&DataInfo", name)
             wx.EVT_MENU(self, wx_id, self. _onDataShow)
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             plot_menu.Append(wx_id, "&Save Points as a File", name)
             wx.EVT_MENU(self, wx_id, self._onSave)
@@ -605,10 +591,13 @@
             # add menu of other plugins
             item_list = self.parent.get_current_context_menu(self)
-
             if (not item_list == None) and (not len(item_list) == 0):
-                for item in item_list:
+                # Note: reusing menu ids in submenu.  This code works because
+                # IdItems is set up as a lazy iterator returning each id in
+                # sequence, creating new ids as needed so it never runs out.
+                # zip() is set up to stop when any iterator is empty, so it
+                # only asks for the number of ids in item_list.
+                for item, wx_id in zip(item_list, self._menu_ids):
 
                     try:
-                        wx_id = self._menu_ids.next()
                         plot_menu.Append(wx_id, item[0], name)
                         wx.EVT_MENU(self, wx_id, item[2])
@@ -620,14 +609,14 @@
 
             if self.parent.ClassName.count('wxDialog') == 0:
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 plot_menu.Append(wx_id, '&Linear Fit', name)
                 wx.EVT_MENU(self, wx_id, self.onFitting)
                 plot_menu.AppendSeparator()
 
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 plot_menu.Append(wx_id, "Remove", name)
                 wx.EVT_MENU(self, wx_id, self._onRemove)
                 if not plot.is_data:
-                    wx_id = self._menu_ids.next()
+                    wx_id = ids.next()
                     plot_menu.Append(wx_id, '&Freeze', name)
                     wx.EVT_MENU(self, wx_id, self.onFreeze)
@@ -635,5 +624,5 @@
 
                 if plot.is_data:
-                    wx_id = self._menu_ids.next()
+                    wx_id = ids.next()
                     self.hide_menu = plot_menu.Append(wx_id, "Hide Error Bar", name)
 
@@ -649,8 +638,8 @@
                     plot_menu.AppendSeparator()
 
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 plot_menu.Append(wx_id, '&Modify Plot Property', name)
                 wx.EVT_MENU(self, wx_id, self.createAppDialog)
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             # plot_menu.SetTitle(name)
             self._slicerpop.AppendMenu(wx_id, '&%s' % name, plot_menu)
@@ -661,9 +650,9 @@
             loc_menu = wx.Menu()
             for label in self._loc_labels:
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 loc_menu.Append(wx_id, str(label), str(label))
                 wx.EVT_MENU(self, wx_id, self.onChangeLegendLoc)
 
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             self._slicerpop.Append(wx_id, '&Modify Graph Appearance',
                                    'Modify graph appearance')
@@ -673,16 +662,16 @@
 
             if self.position != None:
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 self._slicerpop.Append(wx_id, '&Add Text')
                 wx.EVT_MENU(self, wx_id, self._on_addtext)
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 self._slicerpop.Append(wx_id, '&Remove Text')
                 wx.EVT_MENU(self, wx_id, self._on_removetext)
                 self._slicerpop.AppendSeparator()
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             self._slicerpop.Append(wx_id, '&Change Scale')
             wx.EVT_MENU(self, wx_id, self._onProperties)
             self._slicerpop.AppendSeparator()
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             self._slicerpop.Append(wx_id, '&Reset Graph Range')
             wx.EVT_MENU(self, wx_id, self.onResetGraph)
@@ -690,5 +679,5 @@
             if self.parent.ClassName.count('wxDialog') == 0:
                 self._slicerpop.AppendSeparator()
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 self._slicerpop.Append(wx_id, '&Window Title')
                 wx.EVT_MENU(self, wx_id, self.onChangeCaption)
Index: src/sas/guiframe/local_perspectives/plotting/Plotter2D.py
===================================================================
--- src/sas/guiframe/local_perspectives/plotting/Plotter2D.py	(revision 2d88fc4a6cc278c2ea7ac05c75e83d324432f287)
+++ src/sas/guiframe/local_perspectives/plotting/Plotter2D.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -287,18 +287,18 @@
 
         """
-        self._menu_ids.reset()
+        ids = iter(self._menu_ids)
         slicerpop = PanelMenu()
         slicerpop.set_plots(self.plots)
         slicerpop.set_graph(self.graph)
 
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, '&Save Image')
         wx.EVT_MENU(self, wx_id, self.onSaveImage)
 
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, '&Print Image', 'Print image')
         wx.EVT_MENU(self, wx_id, self.onPrint)
 
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, '&Copy to Clipboard', 'Copy to the clipboard')
         wx.EVT_MENU(self, wx_id, self.OnCopyFigureMenu)
@@ -306,9 +306,9 @@
         # saving data
         plot = self.data2D
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, "&Data Info")
         wx.EVT_MENU(self, wx_id, self._onDataShow)
 
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, "&Save as a File (DAT)")
         self.action_ids[str(wx_id)] = plot
@@ -321,7 +321,7 @@
                 self.data2D.name.split(" ")[0] != 'Residuals':
                 # The line above; Not for trunk
-                for item in item_list:
+                # Note: reusing menu ids for the sub-menus.  See Plotter1D.
+                for item, wx_id in zip(item_list, self._menu_ids):
                     try:
-                        wx_id = self._menu_ids.next()
                         slicerpop.Append(wx_id, item[0], item[1])
                         wx.EVT_MENU(self, wx_id, item[2])
@@ -332,38 +332,38 @@
                 slicerpop.AppendSeparator()
 
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             slicerpop.Append(wx_id, '&Perform Circular Average')
             wx.EVT_MENU(self, wx_id, self.onCircular) \
             # For Masked Data
             if not plot.mask.all():
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 slicerpop.Append(wx_id, '&Masked Circular Average')
                 wx.EVT_MENU(self, wx_id, self.onMaskedCircular)
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             slicerpop.Append(wx_id, '&Sector [Q View]')
             wx.EVT_MENU(self, wx_id, self.onSectorQ)
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             slicerpop.Append(wx_id, '&Annulus [Phi View ]')
             wx.EVT_MENU(self, wx_id, self.onSectorPhi)
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             slicerpop.Append(wx_id, '&Box Sum')
             wx.EVT_MENU(self, wx_id, self.onBoxSum)
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             slicerpop.Append(wx_id, '&Box Averaging in Qx')
             wx.EVT_MENU(self, wx_id, self.onBoxavgX)
-            wx_id = self._menu_ids.next()
+            wx_id = ids.next()
             slicerpop.Append(wx_id, '&Box Averaging in Qy')
             wx.EVT_MENU(self, wx_id, self.onBoxavgY)
             if self.slicer != None:
-                wx_id = self._menu_ids.next()
+                wx_id = ids.next()
                 slicerpop.Append(wx_id, '&Clear Slicer')
                 wx.EVT_MENU(self, wx_id, self.onClearSlicer)
                 if self.slicer.__class__.__name__ != "BoxSum":
-                    wx_id = self._menu_ids.next()
+                    wx_id = ids.next()
                     slicerpop.Append(wx_id, '&Edit Slicer Parameters')
                     wx.EVT_MENU(self, wx_id, self._onEditSlicer)
             slicerpop.AppendSeparator()
 
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, '&Edit Graph Label', 'Edit Graph Label')
         wx.EVT_MENU(self, wx_id, self.onEditLabels)
@@ -372,20 +372,20 @@
         # ILL mod here
 
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, '&Modify graph appearance', 'Modify graph appearance')
         wx.EVT_MENU(self, wx_id, self.modifyGraphAppearance)
         slicerpop.AppendSeparator()
 
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, '&2D Color Map')
         wx.EVT_MENU(self, wx_id, self._onEditDetector)
         slicerpop.AppendSeparator()
 
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, '&Toggle Linear/Log Scale')
         wx.EVT_MENU(self, wx_id, self._onToggleScale)
 
         slicerpop.AppendSeparator()
-        wx_id = self._menu_ids.next()
+        wx_id = ids.next()
         slicerpop.Append(wx_id, '&Window Title')
         wx.EVT_MENU(self, wx_id, self.onChangeCaption)
Index: src/sas/guiframe/utils.py
===================================================================
--- src/sas/guiframe/utils.py	(revision 794922220f2fb3b23dd08c648aabf87b4850596c)
+++ src/sas/guiframe/utils.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -123,2 +123,75 @@
     return begin_flag, end_flag
 
+class IdList:
+    """
+    Create a list of wx ids that can be reused.
+
+    Ids for items need to be unique within their context.  In a dynamic
+    application where the number of ids needed different each time the
+    form is created, depending for example, on the number of items that
+    need to be shown in the context menu, you cannot preallocate the
+    ids that you are going to use for the form.  Instead, you can use
+    an IdList, which will reuse ids from context to context, adding new
+    ones if the new context requires more than a previous context.
+
+    IdList is set up as an iterator, which returns new ids forever
+    or until it runs out.  This makes it pretty useful for defining
+    menus::
+
+        class Form(wx.Dialog):
+            _form_id_pool = IdList()
+            def __init__(self):
+                ...
+                menu = wx.Menu()
+                for item, wx_id in zip(menu_items, self._form_id_pool):
+                    name, description, callback = item
+                    menu.Append(wx_id, name, description)
+                    wx.EVT_MENU(self, wx_id, callback)
+                ...
+
+    It is a little unusual to use an iterator outside of a loop, but it is
+    supported. For example, when defining a form, your class definition
+    might look something like::
+
+        class Form(wx.Dialog):
+            _form_id_pool = IdList()
+            def __init__(self, pairs, ...):
+                ids = iter(_form_id_pool)
+                ...
+                wx.StaticText(self, ids.next(), "Some key-value pairs")
+                for name, value in pairs:
+                    label = wx.StaticText(self, ids.next(), name)
+                    input = wx.TextCtrl(self, ids.next(), value=str(value))
+                    ...
+                ...
+
+    If the dialog is really dynamic, and not defined all in one place, then
+    save the id list iterator as *self._ids = iter(_form_id_pool)* in the
+    constructor.
+
+    The wx documentation is not clear on whether ids need to be unique.
+    Clearly different dialogs can use the same ids, as this is done for the
+    standard button ids such as wx.ID_HELP.  Presumably each widget on the
+    form needs its own id, but whether these ids can match the ids of menu
+    items is not indicated, or whether different submenus need their own
+    ids.  Using different id lists for menu items and widgets is safest,
+    but probably not necessary.  And what about notebook tabs.  Do the
+    ids need to be unique across all tabs?
+    """
+    def __init__(self):
+        self._ids = []
+    def __iter__(self):
+        return _IdListIterator(self)
+    def __getitem__(self, index):
+        while index >= len(self._ids):
+            self._ids.append(wx.NewId())
+        return self._ids[index]
+
+class _IdListIterator:
+    def __init__(self, id_list):
+        self.id_list = id_list
+        self.index = -1
+    def next(self):
+        self.index += 1
+        return self.id_list[self.index]
+
Index: src/sas/perspectives/fitting/basepage.py
===================================================================
--- src/sas/perspectives/fitting/basepage.py	(revision 2c8dc199897f6f98c46091ea563218c898baf57a)
+++ src/sas/perspectives/fitting/basepage.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -15,5 +15,5 @@
 from wx.lib.scrolledpanel import ScrolledPanel
 from sas.guiframe.panel_base import PanelBase
-from sas.guiframe.utils import format_number, check_float
+from sas.guiframe.utils import format_number, check_float, IdList
 from sas.guiframe.events import PanelOnFocusEvent
 from sas.guiframe.events import StatusEvent
@@ -57,4 +57,10 @@
     ## Title to appear on top of the window
     window_caption = "Fit Page "
+    # These two buttons have specific IDs since they seem to be created more
+    # frequently than they need to.  In particular, set_dispers_sizer() is
+    # called by _on_select_model
+    ID_BOOKMARK = wx.NewId()
+    ID_DISPERSER_HELP = wx.NewId()
+    _id_pool = IdList()
 
     def __init__(self, parent, color='blue', **kwargs):
@@ -66,6 +72,7 @@
         #Set window's font size
         self.SetWindowVariant(variant=FONT_VARIANT)
-
         self.SetBackgroundColour(color)
+
+        self._ids = iter(self._id_pool)
         ## parent of the page
         self.parent = parent
@@ -199,6 +206,6 @@
         self.popUpMenu = wx.Menu()
 
-        id = wx.NewId()
-        self._keep = wx.MenuItem(self.popUpMenu, id, "Add bookmark",
+        wx_id = self._ids.next()
+        self._keep = wx.MenuItem(self.popUpMenu, wx_id, "Add bookmark",
                                  " Keep the panel status to recall it later")
         self.popUpMenu.AppendItem(self._keep)
@@ -206,5 +213,5 @@
         self._set_bookmark_flag(False)
         self._set_save_flag(False)
-        wx.EVT_MENU(self, id, self.on_bookmark)
+        wx.EVT_MENU(self, wx_id, self.on_bookmark)
         self.popUpMenu.AppendSeparator()
 
@@ -594,13 +601,14 @@
         fill sizer containing dispersity info
         """
+        #print "==== entering set_dispers_sizer ==="
         self.sizer4.Clear(True)
         name = "Polydispersity and Orientational Distribution"
-        box_description = wx.StaticBox(self, -1, name)
+        box_description = wx.StaticBox(self, wx.ID_ANY, name)
         box_description.SetForegroundColour(wx.BLUE)
         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         #----------------------------------------------------
-        self.disable_disp = wx.RadioButton(self, -1, 'Off', (10, 10),
+        self.disable_disp = wx.RadioButton(self, wx.ID_ANY, 'Off', (10, 10),
                                            style=wx.RB_GROUP)
-        self.enable_disp = wx.RadioButton(self, -1, 'On', (10, 30))
+        self.enable_disp = wx.RadioButton(self, wx.ID_ANY, 'On', (10, 30))
         # best size for MAC and PC
         if ON_MAC:
@@ -608,5 +616,5 @@
         else:
             size_q = (20, 15)
-        self.disp_help_bt = wx.Button(self, wx.NewId(), '?',
+        self.disp_help_bt = wx.Button(self, self.ID_DISPERSER_HELP, '?',
                                       style=wx.BU_EXACTFIT,
                                       size=size_q)
@@ -624,5 +632,5 @@
         sizer_dispersion.Add((20, 20))
         name = ""  # Polydispersity and \nOrientational Distribution "
-        sizer_dispersion.Add(wx.StaticText(self, -1, name))
+        sizer_dispersion.Add(wx.StaticText(self, wx.ID_ANY, name))
         sizer_dispersion.Add(self.enable_disp)
         sizer_dispersion.Add((20, 20))
@@ -795,7 +803,6 @@
         wx.PostEvent(self._manager.parent, StatusEvent(status=msg))
 
-        id = wx.NewId()
-        self.popUpMenu.Append(id, name, str(msg))
-        wx.EVT_MENU(self, id, self.onResetModel)
+        self.popUpMenu.Append(self.ID_BOOKMARK, name, str(msg))
+        wx.EVT_MENU(self, self.ID_BOOKMARK, self.onResetModel)
         wx.PostEvent(self._manager.parent,
                      AppendBookmarkEvent(title=name,
@@ -1438,11 +1445,12 @@
         reset the context menu
         """
+        ids = iter(self._id_pool)  # Reusing ids for context menu
         for name, _ in self.state.saved_states.iteritems():
             self.number_saved_state += 1
             ## Add item in the context menu
-            id = wx.NewId()
+            wx_id = ids.next()
             msg = 'Save model and state %g' % self.number_saved_state
-            self.popUpMenu.Append(id, name, msg)
-            wx.EVT_MENU(self, id, self.onResetModel)
+            self.popUpMenu.Append(wx_id, name, msg)
+            wx.EVT_MENU(self, wx_id, self.onResetModel)
 
     def _reset_plotting_range(self, state):
@@ -1831,5 +1839,6 @@
         sld_data.name = 'SLD'
         sld_data.axes = self.sld_axes
-        self.panel = SLDPanel(self, data=sld_data, axes=self.sld_axes, id= -1)
+        self.panel = SLDPanel(self, data=sld_data, axes=self.sld_axes,
+                              id=wx.ID_ANY)
         self.panel.ShowModal()
 
@@ -2421,5 +2430,5 @@
         self.sizer4_4.Clear(True)
         text = "No polydispersity available for this model"
-        model_disp = wx.StaticText(self, -1, text)
+        model_disp = wx.StaticText(self, wx.ID_ANY, text)
         self.sizer4_4.Add(model_disp, (iy, ix), (1, 1),
                           wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 10)
@@ -2851,9 +2860,9 @@
             name = self.formfactorbox.GetValue()
             _PageAnchor = '#' + name.lower()
-            _doc_viewer = DocumentationWindow(self, -1, _TreeLocation,
+            _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation,
                                               _PageAnchor, name + " Help")
         else:
-            _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",
-                                                "General Model Help")
+            _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation,
+                                              "", "General Model Help")
 
 
@@ -2906,5 +2915,5 @@
 
         _TreeLocation = "_images/M_angles_pic.bmp"
-        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",
+        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "",
                                           "Magnetic Angle Defintions")
 
@@ -2926,5 +2935,5 @@
 
         _TreeLocation = "user/perspectives/fitting/mag_help.html"
-        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "",
+        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "",
                                           "Polarized Beam/Magnetc Help")
 
@@ -2973,5 +2982,5 @@
         _TreeLocation = "user/perspectives/fitting/pd_help.html"
         _PageAnchor = ""
-        _doc_viewer = DocumentationWindow(self, -1, _TreeLocation,
+        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation,
                                           _PageAnchor, "Polydispersity Help")
 
@@ -3517,4 +3526,6 @@
         fill sizer containing model info
         """
+        # This should only be called once per fit tab
+        #print "==== Entering _fill_model_sizer"
         ##Add model function Details button in fitpanel.
         ##The following 3 lines are for Mac. Let JHC know before modifying...
@@ -3522,35 +3533,40 @@
         self.formfactorbox = None
         self.multifactorbox = None
-        self.mbox_description = wx.StaticBox(self, -1, str(title))
+        self.mbox_description = wx.StaticBox(self, wx.ID_ANY, str(title))
         boxsizer1 = wx.StaticBoxSizer(self.mbox_description, wx.VERTICAL)
         sizer_cat = wx.BoxSizer(wx.HORIZONTAL)
         self.mbox_description.SetForegroundColour(wx.RED)
-        id = wx.NewId()
-        self.model_func = wx.Button(self, id, 'Help', size=(80, 23))
-        self.model_func.Bind(wx.EVT_BUTTON, self.on_function_help_clicked, id=id)
+        wx_id = self._ids.next()
+        self.model_func = wx.Button(self, wx_id, 'Help', size=(80, 23))
+        self.model_func.Bind(wx.EVT_BUTTON, self.on_function_help_clicked,
+                             id=wx_id)
         self.model_func.SetToolTipString("Full Model Function Help")
-        id = wx.NewId()
-        self.model_help = wx.Button(self, id, 'Description', size=(80, 23))
-        self.model_help.Bind(wx.EVT_BUTTON, self.on_model_help_clicked, id=id)
+        wx_id = self._ids.next()
+        self.model_help = wx.Button(self, wx_id, 'Description', size=(80, 23))
+        self.model_help.Bind(wx.EVT_BUTTON, self.on_model_help_clicked,
+                             id=wx_id)
         self.model_help.SetToolTipString("Short Model Function Description")
-        id = wx.NewId()
-        self.model_view = wx.Button(self, id, "Show 2D", size=(80, 23))
-        self.model_view.Bind(wx.EVT_BUTTON, self._onModel2D, id=id)
+        wx_id = self._ids.next()
+        self.model_view = wx.Button(self, wx_id, "Show 2D", size=(80, 23))
+        self.model_view.Bind(wx.EVT_BUTTON, self._onModel2D, id=wx_id)
         hint = "toggle view of model from 1D to 2D  or 2D to 1D"
         self.model_view.SetToolTipString(hint)
 
-        cat_set_box = wx.StaticBox(self, -1, 'Category')
+        cat_set_box = wx.StaticBox(self, wx.ID_ANY, 'Category')
         sizer_cat_box = wx.StaticBoxSizer(cat_set_box, wx.HORIZONTAL)
         sizer_cat_box.SetMinSize((200, 50))
-        self.categorybox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.categorybox = wx.ComboBox(self, wx.ID_ANY,
+                                       style=wx.CB_READONLY)
         self.categorybox.SetToolTip(wx.ToolTip("Select a Category/Type"))
         self._populate_listbox()
-        wx.EVT_COMBOBOX(self.categorybox, -1, self._show_combox)
-        #self.shape_rbutton = wx.RadioButton(self, -1, 'Shapes',
+        wx.EVT_COMBOBOX(self.categorybox, wx.ID_ANY, self._show_combox)
+        #self.shape_rbutton = wx.RadioButton(self, wx.ID_ANY, 'Shapes',
         #                                     style=wx.RB_GROUP)
-        #self.shape_indep_rbutton = wx.RadioButton(self, -1,
+        #self.shape_indep_rbutton = wx.RadioButton(self, wx.ID_ANY,
         #                                          "Shape-Independent")
-        #self.struct_rbutton = wx.RadioButton(self, -1, "Structure Factor ")
-        #self.plugin_rbutton = wx.RadioButton(self, -1, "Uncategorized")
+        #self.struct_rbutton = wx.RadioButton(self, wx.ID_ANY,
+        #                                     "Structure Factor ")
+        #self.plugin_rbutton = wx.RadioButton(self, wx.ID_ANY,
+        #                                     "Uncategorized")
 
         #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox,
@@ -3564,5 +3580,5 @@
         #MAC needs SetValue
 
-        show_cat_button = wx.Button(self, -1, "Modify")
+        show_cat_button = wx.Button(self, wx.ID_ANY, "Modify")
         cat_tip = "Modify model categories \n"
         cat_tip += "(also accessible from the menu bar)."
@@ -3590,22 +3606,22 @@
         mutifactor_selection = wx.BoxSizer(wx.HORIZONTAL)
 
-        self.text1 = wx.StaticText(self, -1, "")
-        self.text2 = wx.StaticText(self, -1, "P(Q)*S(Q)")
-        self.mutifactor_text = wx.StaticText(self, -1, "No. of Shells: ")
-        self.mutifactor_text1 = wx.StaticText(self, -1, "")
-        self.show_sld_button = wx.Button(self, -1, "Show SLD Profile")
+        self.text1 = wx.StaticText(self, wx.ID_ANY, "")
+        self.text2 = wx.StaticText(self, wx.ID_ANY, "P(Q)*S(Q)")
+        self.mutifactor_text = wx.StaticText(self, wx.ID_ANY, "No. of Shells: ")
+        self.mutifactor_text1 = wx.StaticText(self, wx.ID_ANY, "")
+        self.show_sld_button = wx.Button(self, wx.ID_ANY, "Show SLD Profile")
         self.show_sld_button.Bind(wx.EVT_BUTTON, self._on_show_sld)
 
-        self.formfactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.formfactorbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)
         self.formfactorbox.SetToolTip(wx.ToolTip("Select a Model"))
         if self.model != None:
             self.formfactorbox.SetValue(self.model.name)
-        self.structurebox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
-        self.multifactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.structurebox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)
+        self.multifactorbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)
         self.initialize_combox()
-        wx.EVT_COMBOBOX(self.formfactorbox, -1, self._on_select_model)
-
-        wx.EVT_COMBOBOX(self.structurebox, -1, self._on_select_model)
-        wx.EVT_COMBOBOX(self.multifactorbox, -1, self._on_select_model)
+        wx.EVT_COMBOBOX(self.formfactorbox, wx.ID_ANY, self._on_select_model)
+
+        wx.EVT_COMBOBOX(self.structurebox, wx.ID_ANY, self._on_select_model)
+        wx.EVT_COMBOBOX(self.multifactorbox, wx.ID_ANY, self._on_select_model)
         ## check model type to show sizer
         if self.model != None:
Index: src/sas/perspectives/fitting/batchfitpage.py
===================================================================
--- src/sas/perspectives/fitting/batchfitpage.py	(revision 373d4eebe3a548f70f917fec87bdb5280e67d1e0)
+++ src/sas/perspectives/fitting/batchfitpage.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -38,5 +38,5 @@
         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
@@ -47,17 +47,17 @@
         #----------------------------------------------------------
         sizer_data = wx.BoxSizer(wx.VERTICAL)
-        text1 = wx.StaticText(self, -1, ' - Choose a file to set initial fit parameters -')
+        text1 = wx.StaticText(self, wx.ID_ANY, ' - Choose a file to set initial fit parameters -')
         text1.SetForegroundColour(wx.RED)
         sizer_data.Add(text1)
-        text2 = wx.StaticText(self, -1, ' - This panel is not designed to view individual fits. - ')
+        text2 = wx.StaticText(self, wx.ID_ANY, ' - This panel is not designed to view individual fits. - ')
         text2.SetForegroundColour(wx.RED)
         sizer_data.Add(text2)
 
         combo = 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))
 
-        combo.Add(wx.StaticText(self, -1, 'Name : '))
+        combo.Add(wx.StaticText(self, wx.ID_ANY, 'Name : '))
         combo.Add((0, 5))
         combo.Add(self.dataSource)
@@ -86,5 +86,5 @@
 #         
 #         #Sizers
-#         box_description_range = wx.StaticBox(self, -1, str(title))
+#         box_description_range = wx.StaticBox(self, wx.ID_ANY, str(title))
 #         boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL)      
 #         self.sizer_set_smearer = wx.BoxSizer(wx.VERTICAL)
@@ -96,5 +96,5 @@
 #         sizer_fit = wx.GridSizer(2, 4, 2, 6)
 #         #Fit button
-#         self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=(88, 25))
+#         self.btFit = wx.Button(self, self._ids.next(), 'Fit', size=(88, 25))
 #         self.default_bt_colour =  self.btFit.GetDefaultAttributes()
 #         self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id= self.btFit.GetId())
@@ -102,5 +102,5 @@
 # 
 #         # Update and Draw button
-#         self.draw_button = wx.Button(self, wx.NewId(), 'Compute', size=(88, 24))
+#         self.draw_button = wx.Button(self, self._ids.next(), 'Compute', size=(88, 24))
 #         self.draw_button.Bind(wx.EVT_BUTTON, \
 #                               self._onDraw,id=self.draw_button.GetId())
@@ -122,5 +122,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, 
 #                                     text_enter_callback = self._onQrangeEnter)
@@ -128,5 +128,5 @@
 #         self.qmin.SetToolTipString("Minimun value of Q in linear scale.")
 #      
-#         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, 
 #                                         text_enter_callback=self._onQrangeEnter)
@@ -134,5 +134,5 @@
 #         self.qmax.SetToolTipString("Maximum value of Q in linear scale.")
 #         
-#         id = wx.NewId()
+#         id = self._ids.next()
 #         self.reset_qrange =wx.Button(self, id, 'Reset', size=(77, 20))
 #       
@@ -144,13 +144,13 @@
 #         sizer = wx.GridSizer(2, 4, 2, 6)
 # 
-#         self.btEditMask = wx.Button(self, wx.NewId(),'Editor', size=(88, 23))
+#         self.btEditMask = wx.Button(self, self._ids.next(),'Editor', size=(88, 23))
 #         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)
 #  
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")
Index: src/sas/perspectives/fitting/fitpanel.py
===================================================================
--- src/sas/perspectives/fitting/fitpanel.py	(revision ac7be54ccf932e813cbe6e41e05b682a1630a03e)
+++ src/sas/perspectives/fitting/fitpanel.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -36,5 +36,5 @@
         """
         """
-        nb.__init__(self, parent, -1,
+        nb.__init__(self, parent, wx.ID_ANY,
                     style=wx.aui.AUI_NB_WINDOWLIST_BUTTON |
                     wx.aui.AUI_NB_DEFAULT_STYLE |
@@ -324,5 +324,5 @@
         if caption == "Const & Simul Fit":
             self.sim_page = SimultaneousFitPage(self, page_finder=page_finder,
-                                                 id= -1, batch_on=False)
+                                                 id= wx.ID_ANY, batch_on=False)
             self.sim_page.window_caption = caption
             self.sim_page.window_name = caption
Index: src/sas/perspectives/fitting/fitting.py
===================================================================
--- src/sas/perspectives/fitting/fitting.py	(revision 7945367d6e45b1f5abeedcae09a5284e3063d095)
+++ src/sas/perspectives/fitting/fitting.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -277,5 +277,5 @@
         model_list = model_manager.get_model_name_list()
         plug_dir = models.find_plugins_dir()
-        textdial = TextDialog(None, self, -1, 'Easy Sum/Multi(p1, p2) Editor',
+        textdial = TextDialog(None, self, wx.ID_ANY, 'Easy Sum/Multi(p1, p2) Editor',
                               model_list, plug_dir)
         self.put_icon(textdial)
@@ -760,5 +760,5 @@
         _TreeLocation = "user/perspectives/fitting/optimizer.html"
         _anchor = "#fit-"+algorithm_id
-        DocumentationWindow(self.parent, -1, _TreeLocation, _anchor, "Optimizer Help")
+        DocumentationWindow(self.parent, wx.ID_ANY, _TreeLocation, _anchor, "Optimizer Help")
 
 
Index: src/sas/perspectives/fitting/fitting_widgets.py
===================================================================
--- src/sas/perspectives/fitting/fitting_widgets.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
+++ src/sas/perspectives/fitting/fitting_widgets.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -41,11 +41,11 @@
         """
         vbox = wx.BoxSizer(wx.VERTICAL)
-        box_description = wx.StaticBox(self, -1, str("Hint"))
+        box_description = wx.StaticBox(self, wx.ID_ANY, str("Hint"))
         hint_sizer = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         selection_sizer = wx.GridBagSizer(5, 5)
         button_sizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.data_1d_selected = wx.RadioButton(self, -1, 'Data1D',
+        self.data_1d_selected = wx.RadioButton(self, wx.ID_ANY, 'Data1D',
                                                 style=wx.RB_GROUP)
-        self.data_2d_selected = wx.RadioButton(self, -1, 'Data2D')
+        self.data_2d_selected = wx.RadioButton(self, wx.ID_ANY, 'Data2D')
         self.data_1d_selected.SetValue(True)
         self.data_2d_selected.SetValue(False)
@@ -55,5 +55,5 @@
         hint = "Selected Data set contains both 1D and 2D Data.\n"
         hint += "Please select on type of analysis before proceeding.\n"
-        hint_sizer.Add(wx.StaticText(self, -1, hint))
+        hint_sizer.Add(wx.StaticText(self, wx.ID_ANY, hint))
         #draw area containing radio buttons
         ix = 0
@@ -72,5 +72,5 @@
         vbox.Add(hint_sizer, 0, wx.EXPAND | wx.ALL, 10)
         vbox.Add(selection_sizer, 0, wx.TOP | wx.BOTTOM, 10)
-        vbox.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0)
+        vbox.Add(wx.StaticLine(self, wx.ID_ANY), 0, wx.EXPAND, 0)
         vbox.Add(button_sizer, 0, wx.TOP | wx.BOTTOM, 10)
         self.SetSizer(vbox)
@@ -103,5 +103,5 @@
             return
         select_data_text = " %s Data selected.\n" % str(self._nb_selected_data)
-        self._data_text_ctrl = wx.StaticText(self, -1, str(select_data_text))
+        self._data_text_ctrl = wx.StaticText(self, wx.ID_ANY, str(select_data_text))
 
         self._data_text_ctrl.SetForegroundColour('blue')
@@ -126,5 +126,5 @@
             text += "for adequate plot display size. \n"
             text += "unchecked data won't be send to fitting . \n"
-        text_ctrl = wx.StaticText(self, -1, str(text))
+        text_ctrl = wx.StaticText(self, wx.ID_ANY, str(text))
         self._sizer_txt.Add(text_ctrl)
         iy = 0
@@ -133,5 +133,5 @@
         for i in range(len(data_list)):
             data_count += 1
-            cb = wx.CheckBox(self._panel, -1, str(data_list[i].name), (10, 10))
+            cb = wx.CheckBox(self._panel, wx.ID_ANY, str(data_list[i].name), (10, 10))
             wx.EVT_CHECKBOX(self, cb.GetId(), self._count_selected_data)
             if data_count <= MAX_NBR_DATA:
@@ -153,5 +153,5 @@
         self._sizer_button.Add(button_OK, 0,
                                 wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
-        static_line = wx.StaticLine(self, -1)
+        static_line = wx.StaticLine(self, wx.ID_ANY)
         self._sizer_txt.Add(self._panel, 0, wx.EXPAND | wx.ALL, 10)
         self._sizer_main.Add(self._sizer_txt, 0, wx.EXPAND | wx.ALL, 10)
Index: src/sas/perspectives/fitting/hint_fitpage.py
===================================================================
--- src/sas/perspectives/fitting/hint_fitpage.py	(revision 2f4b43041eaa7b7f496750f223a299cb33cd268e)
+++ src/sas/perspectives/fitting/hint_fitpage.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -27,5 +27,5 @@
         """
         name = "Hint"
-        box_description = wx.StaticBox(self, -1, name)
+        box_description = wx.StaticBox(self, wx.ID_ANY, name)
         boxsizer = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         msg = "    How to link data to the control panel: \n \n"
@@ -33,5 +33,5 @@
         msg += "    Then Highlight and right click on the data plot. \n"
         msg += "    Finally, select 'Select data for fitting' in the pop-up menu. \n"
-        self.hint_txt = wx.StaticText(self, -1, msg, style=wx.ALIGN_LEFT)
+        self.hint_txt = wx.StaticText(self, wx.ID_ANY, msg, style=wx.ALIGN_LEFT)
         boxsizer.Add(self.hint_txt, wx.ALL | wx.EXPAND, 20)
         self.vbox = wx.BoxSizer(wx.VERTICAL)
Index: src/sas/perspectives/fitting/pagestate.py
===================================================================
--- src/sas/perspectives/fitting/pagestate.py	(revision 0e33a8d85cb72949d5570ad7e0ae62153a71b845)
+++ src/sas/perspectives/fitting/pagestate.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -605,5 +605,5 @@
         images = self.set_plot_state(figs, canvases)
         report_list = [report_str, text_str, images]
-        dialog = ReportDialog(report_list, None, -1, "")
+        dialog = ReportDialog(report_list, None, wx.ID_ANY, "")
         dialog.Show()
 
Index: src/sas/perspectives/fitting/resultpanel.py
===================================================================
--- src/sas/perspectives/fitting/resultpanel.py	(revision 9df6a03015af83c5e84c1877daf2f74af85ad4e0)
+++ src/sas/perspectives/fitting/resultpanel.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -41,5 +41,5 @@
                  | wx.CLIP_CHILDREN)
                  & ~wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB)
-        Notebook.__init__(self, parent, -1, style=style)
+        Notebook.__init__(self, parent, wx.ID_ANY, style=style)
         PanelBase.__init__(self, parent)
         self.frame = parent
Index: src/sas/perspectives/fitting/simfitpage.py
===================================================================
--- src/sas/perspectives/fitting/simfitpage.py	(revision acf8e4a58aad50df871a259b771db1d582942abb)
+++ src/sas/perspectives/fitting/simfitpage.py	(revision 6f16e25ca8391464dfcea6ba0d48d6b3702d148e)
@@ -46,6 +46,10 @@
     ## Title to appear on top of the window
     window_caption = "Simultaneous Fit Page"
-
-    def __init__(self, parent, page_finder={}, id= -1, batch_on=False,
+    ID_SET_ALL = wx.NewId()
+    ID_REMOVE = wx.NewId()
+    ID_FIT = wx.NewId()
+    ID_ADD = wx.NewId()
+
+    def __init__(self, parent, page_finder={}, id= wx.ID_ANY, batch_on=False,
                      *args, **kwargs):
         ScrolledPanel.__init__(self, parent, id=id,
@@ -78,5 +82,4 @@
         self.model_cbox_left = None
         self.model_cbox_right = None
-        self.uid = wx.NewId()
         ## draw page
         self.define_page_structure()
@@ -294,5 +297,5 @@
 
         self.sizer1.Clear(True)
-        box_description = wx.StaticBox(self, -1, "Fit Combinations")
+        box_description = wx.StaticBox(self, wx.ID_ANY, "Fit Combinations")
         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         sizer_title = wx.BoxSizer(wx.HORIZONTAL)
@@ -303,10 +306,10 @@
             msg += " Please load data and set up "
             msg += "at least two fit panels first..."
-            sizer_title.Add(wx.StaticText(self, -1, msg))
+            sizer_title.Add(wx.StaticText(self, wx.ID_ANY, msg))
         else:
             ## store model
             self._store_model()
 
-            self.cb1 = wx.CheckBox(self, -1, 'Select all')
+            self.cb1 = wx.CheckBox(self, wx.ID_ANY, 'Select all')
             self.cb1.SetValue(False)
 
@@ -370,15 +373,15 @@
         Show constraint fields
         """
-        box_description = wx.StaticBox(self, -1, "Easy Setup ")
+        box_description = wx.StaticBox(self, wx.ID_ANY, "Easy Setup ")
         boxsizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL)
         sizer_constraint = wx.BoxSizer(wx.HORIZONTAL)
-        self.model_cbox_left = wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.model_cbox_left = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)
         self.model_cbox_left.Clear()
-        self.model_cbox_right = wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        self.model_cbox_right = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)
         self.model_cbox_right.Clear()
-        wx.EVT_COMBOBOX(self.model_cbox_left, -1, self._on_select_modelcb)
-        wx.EVT_COMBOBOX(self.model_cbox_right, -1, self._on_select_modelcb)
-        egal_txt = wx.StaticText(self, -1, " = ")
-        self.set_button = wx.Button(self, wx.NewId(), 'Set All')
+        wx.EVT_COMBOBOX(self.model_cbox_left, wx.ID_ANY, self._on_select_modelcb)
+        wx.EVT_COMBOBOX(self.model_cbox_right, wx.ID_ANY, self._on_select_modelcb)
+        egal_txt = wx.StaticText(self, wx.ID_ANY, " = ")
+        self.set_button = wx.Button(self, self.ID_SET_ALL, 'Set All')
         self.set_button.Bind(wx.EVT_BUTTON, self._on_set_all_equal,
                              id=self.set_button.GetId())
@@ -399,10 +402,10 @@
         boxsizer.Add(self.model_cbox_left,
                              flag=wx.RIGHT | wx.EXPAND, border=10)
-        boxsizer.Add(wx.StaticText(self, -1, ".parameters"),
+        boxsizer.Add(wx.StaticText(self, wx.ID_ANY, ".parameters"),
                              flag=wx.RIGHT | wx.EXPAND, border=5)
         boxsizer.Add(egal_txt, flag=wx.RIGHT | wx.EXPAND, border=5)
         boxsizer.Add(self.model_cbox_right,
                              flag=wx.RIGHT | wx.EXPAND, border=10)
-        boxsizer.Add(wx.StaticText(self, -1, ".parameters"),
+        boxsizer.Add(wx.StaticText(self, wx.ID_ANY, ".parameters"),
                              flag=wx.RIGHT | wx.EXPAND, border=5)
         boxsizer.Add((20, -1))
@@ -510,7 +513,7 @@
 
         sizer_constraint = wx.BoxSizer(wx.HORIZONTAL)
-        model_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)
+        model_cbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)
         model_cbox.Clear()
-        param_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY, size=(100, -1),)
+        param_cbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY, size=(100, -1),)
         param_cbox.Hide()
 
@@ -518,8 +521,8 @@
         self.param_cbox = param_cbox
 
-        wx.EVT_COMBOBOX(param_cbox, -1, self._on_select_param)
-        self.ctl2 = wx.TextCtrl(self, -1)
-        egal_txt = wx.StaticText(self, -1, " = ")
-        self.btRemove = wx.Button(self, wx.NewId(), 'Remove')
+        wx.EVT_COMBOBOX(param_cbox, wx.ID_ANY, self._on_select_param)
+        self.ctl2 = wx.TextCtrl(self, wx.ID_ANY)
+        egal_txt = wx.StaticText(self, wx.ID_ANY, " = ")
+        self.btRemove = wx.Button(self, self.ID_REMOVE, 'Remove')
         self.btRemove.Bind(wx.EVT_BUTTON, self.onRemove,
                            id=self.btRemove.GetId())
@@ -536,6 +539,6 @@
         self.model_cbox = model_cbox
 
-        wx.EVT_COMBOBOX(model_cbox, -1, self._on_select_model)
-        sizer_constraint.Add((5, -1))
+        wx.EVT_COMBOBOX(model_cbox, wx.ID_ANY, self._on_select_model)
+        sizer_constraint.Add((5, wx.ID_ANY))
         sizer_constraint.Add(model_cbox, flag=wx.RIGHT | wx.EXPAND, border=10)
         sizer_constraint.Add(param_cbox, flag=wx.RIGHT | wx.EXPAND, border=5)
@@ -672,9 +675,9 @@
         """
         self.sizer3.Clear(True)
-        box_description = wx.StaticBox(self, -1, "Fit ")
+        box_description = wx.StaticBox(self, wx.ID_ANY, "Fit ")
         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         sizer_button = wx.BoxSizer(wx.HORIZONTAL)
 
-        self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=wx.DefaultSize)
+        self.btFit = wx.Button(self, self.ID_FIT, 'Fit', size=wx.DefaultSize)
         self.btFit.Bind(wx.EVT_BUTTON, self.onFit, id=self.btFit.GetId())
         self.btFit.SetToolTipString("Perform fit.")
@@ -684,5 +687,5 @@
             text = " This page requires at least one FitPage with a data\n"
             text = " and a model for fitting."
-        text_hint = wx.StaticText(self, -1, text)
+        text_hint = wx.StaticText(self, wx.ID_ANY, text)
 
         sizer_button.Add(text_hint, wx.RIGHT | wx.EXPAND, 10)
@@ -705,5 +708,5 @@
                 self.sizer2.Show(False)
             return
-        box_description = wx.StaticBox(self, -1, "Fit Constraints")
+        box_description = wx.StaticBox(self, wx.ID_ANY, "Fit Constraints")
         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
         sizer_title = wx.BoxSizer(wx.HORIZONTAL)
@@ -712,7 +715,7 @@
         sizer_button = wx.BoxSizer(wx.HORIZONTAL)
 
-        self.hide_constraint = wx.RadioButton(self, -1, 'No', (10, 10),
+        self.hide_constraint = wx.RadioButton(self, wx.ID_ANY, 'No', (10, 10),
                                               style=wx.RB_GROUP)
-        self.show_constraint = wx.RadioButton(self, -1, 'Yes', (10, 30))
+        self.show_constraint = wx.RadioButton(self, wx.ID_ANY, 'Yes', (10, 30))
         self.Bind(wx.EVT_RADIOBUTTON, self._display_constraint,
                   id=self.hide_constraint.GetId())
@@ -725,9 +728,9 @@
         self.show_constraint.SetValue(False)
 
-        sizer_title.Add(wx.StaticText(self, -1, " Model"))
+        sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Model"))
         sizer_title.Add((10, 10))
-        sizer_title.Add(wx.StaticText(self, -1, " Parameter"))
+        sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Parameter"))
         sizer_title.Add((10, 10))
-        sizer_title.Add(wx.StaticText(self, -1, " Add Constraint?"))
+        sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Add Constraint?"))
         sizer_title.Add((10, 10))
         sizer_title.Add(self.show_constraint)
@@ -735,5 +738,5 @@
         sizer_title.Add((10, 10))
 
-        self.btAdd = wx.Button(self, wx.NewId(), 'Add')
+        self.btAdd = wx.Button(self, self.ID_ADD, 'Add')
         self.btAdd.Bind(wx.EVT_BUTTON, self._onAdd_constraint,
                         id=self.btAdd.GetId())
@@ -741,5 +744,5 @@
         self.btAdd.Hide()
 
-        text_hint = wx.StaticText(self, -1,
+        text_hint = wx.StaticText(self, wx.ID_ANY,
                                   "Example: [M0][paramter] = M1.parameter")
         sizer_button.Add(text_hint, 0 , wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 10)
@@ -821,5 +824,5 @@
         sizer.Clear(True)
 
-        new_name = wx.StaticText(self, -1, '  Model Title ',
+        new_name = wx.StaticText(self, wx.ID_ANY, '  Model Title ',
                                  style=wx.ALIGN_CENTER)
         new_name.SetBackgroundColour('orange')
@@ -828,5 +831,5 @@
                             wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)
         ix += 2
-        model_type = wx.StaticText(self, -1, '  Model ')
+        model_type = wx.StaticText(self, wx.ID_ANY, '  Model ')
         model_type.SetBackgroundColour('grey')
         model_type.SetForegroundColour(wx.WHITE)
@@ -834,5 +837,5 @@
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
-        data_used = wx.StaticText(self, -1, '  Data ')
+        data_used = wx.StaticText(self, wx.ID_ANY, '  Data ')
         data_used.SetBackgroundColour('grey')
         data_used.SetForegroundColour(wx.WHITE)
@@ -840,5 +843,5 @@
                             wx.EXPAND | wx.ADJUST_MINSIZE, 0)
         ix += 1
-        tab_used = wx.StaticText(self, -1, '  FitPage ')
+        tab_used = wx.StaticText(self, wx.ID_ANY, '  FitPage ')
         tab_used.SetBackgroundColour('grey')
         tab_used.SetForegroundColour(wx.WHITE)
@@ -879,5 +882,5 @@
             if model is not None:
                 name = str(model.name)
-            cb = wx.CheckBox(self, -1, name)
+            cb = wx.CheckBox(self, wx.ID_ANY, name)
             cb.SetValue(False)
             cb.Enable(model is not None and data.is_data)
@@ -887,13 +890,13 @@
             ix += 2
             type = model.__class__.__name__
-            model_type = wx.StaticText(self, -1, str(type))
+            model_type = wx.StaticText(self, wx.ID_ANY, str(type))
             sizer.Add(model_type, (iy, ix), (1, 1),
                       wx.EXPAND | wx.ADJUST_MINSIZE, 0)
             if self.batch_on:
-                data_used = wx.ComboBox(self, -1, style=wx.CB_READONLY)
+                data_used = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)
                 data_used.AppendItems(data_list)
                 data_used.SetSelection(0)
             else:
-                data_used = wx.StaticText(self, -1, data_list[0])
+                data_used = wx.StaticText(self, wx.ID_ANY, data_list[0])
 
             ix += 1
@@ -902,5 +905,5 @@
             ix += 1
             caption = value.get_fit_tab_caption()
-            tab_caption_used = wx.StaticText(self, -1, str(caption))
+            tab_caption_used = wx.StaticText(self, wx.ID_ANY, str(caption))
             sizer.Add(tab_caption_used, (iy, ix), (1, 1),
                       wx.EXPAND | wx.ADJUST_MINSIZE, 0)
