.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.RearrangeDialog:

==========================================================================================================================================
|phoenix_title|  **wx.RearrangeDialog**
==========================================================================================================================================

A dialog allowing the user to rearrange the specified items.          

This dialog can be used to allow the user to modify the order of the items and to enable or disable them individually. For example: ::

        items = ["meat", "fish", "fruits", "beer"]
        order = [3, 0, 1, 2]

        dlg = wx.RearrangeDialog(None,
                                 "You can also uncheck the items you don't like "
                                 "at all.",
                                 "Sort the items in order of preference",
                                 order, items)

        if dlg.ShowModal() == wx.ID_OK:
            order = dlg.GetOrder()
            for n in order:
                if n >= 0:
                    wx.LogMessage("Your most preferred item is \"%s\""%n)
                    break









.. versionadded:: 2.9.0 
    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>RearrangeDialog</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.RearrangeDialog_inheritance.png" alt="Inheritance diagram of RearrangeDialog" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.RearrangeDialog.html" title="wx.RearrangeDialog" alt="" coords="32,469,185,499"/> <area shape="rect" id="node2" href="wx.Dialog.html" title="wx.Dialog" alt="" coords="65,392,152,421"/> <area shape="rect" id="node3" href="wx.TopLevelWindow.html" title="wx.TopLevelWindow" alt="" coords="31,315,186,344"/> <area shape="rect" id="node4" href="wx.NonOwnedWindow.html" title="wx.NonOwnedWindow" alt="" coords="25,237,193,267"/> <area shape="rect" id="node5" href="wx.Window.html" title="wx.Window" alt="" coords="60,160,157,189"/> <area shape="rect" id="node6" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="50,83,167,112"/> <area shape="rect" id="node7" href="wx.Object.html" title="wx.Object" alt="" coords="5,5,92,35"/> <area shape="rect" id="node8" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="117,5,223,35"/> </map> 
   </p>
   </div>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.RearrangeDialog.__init__`                                             Default constructor.
:meth:`~wx.RearrangeDialog.AddExtraControls`                                     Customize the dialog by adding extra controls to it.
:meth:`~wx.RearrangeDialog.Create`                                               Effectively creates the dialog for an object created using the default constructor.
:meth:`~wx.RearrangeDialog.GetClassDefaultAttributes`                            
:meth:`~wx.RearrangeDialog.GetList`                                              Return the list control used by the dialog.
:meth:`~wx.RearrangeDialog.GetOrder`                                             Return the array describing the order of items after it was modified by the user.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.RearrangeDialog.List`                                                 See :meth:`~wx.RearrangeDialog.GetList`
:attr:`~wx.RearrangeDialog.Order`                                                See :meth:`~wx.RearrangeDialog.GetOrder`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.RearrangeDialog(Dialog)

   **Possible constructors**::

       RearrangeDialog()
       
       RearrangeDialog(parent, message, title=EmptyString, order=[], items=[],
                       pos=DefaultPosition, name=RearrangeDialogNameStr)
       
   
   A dialog allowing the user to rearrange the specified items.



   .. method:: __init__(self, *args, **kw)



      |overload| Overloaded Implementations:

      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self)`
      
      Default constructor.                  
      
      :meth:`Create`   must be called later to effectively create the control.                   
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`

      
      **__init__** `(self, parent, message, title=EmptyString, order=[], items=[], pos=DefaultPosition, name=RearrangeDialogNameStr)`
      
      Constructor creating the dialog.                  
      
      Please see :meth:`Create`   for the parameters description.                  
      
      
      :param `parent`: 
      :type `parent`: wx.Window
      :param `message`: 
      :type `message`: string
      :param `title`: 
      :type `title`: string
      :param `order`: 
      :type `order`: list of integers
      :param `items`: 
      :type `items`: list of strings
      :param `pos`: 
      :type `pos`: wx.Point
      :param `name`: 
      :type `name`: string
      
      
      
      
      
      
      :html:`<hr class="overloadsep" /><br />`






   .. method:: AddExtraControls(self, win)

      Customize the dialog by adding extra controls to it.                  

      This function adds the given `win`  to the dialog, putting it just below the part occupied by :ref:`wx.RearrangeCtrl`. It must be called after creating the dialog and you will typically need to process the events generated by the extra controls for them to do something useful. 

      For example: ::

              class MyRearrangeDialog(wx.RearrangeDialog):

                  def __init__(self, parent):

                      wx.RearrangeDialog.__init__(self, parent)

                      panel = wx.Panel(self)
                      sizer = wx.BoxSizer(wx.HORIZONTAL)
                      sizer.Add(wx.StaticText(panel, wx.ID_ANY,
                                              "Column width in pixels:"))
                      sizer.Add(wx.TextCtrl(panel, wx.ID_ANY, ""))
                      panel.SetSizer(sizer)
                      self.AddExtraControls(panel)


                      # ... code to update the text control with the currently selected
                      # item width and to react to its changes omitted ...



      See also the complete example of a custom rearrange dialog in the dialogs sample. 




      :param `win`: The window containing the extra controls. It must have this dialog as its parent.   
      :type `win`: wx.Window




                  





   .. method:: Create(self, parent, message, title=EmptyString, order=[], items=[], pos=DefaultPosition, name=RearrangeDialogNameStr)

      Effectively creates the dialog for an object created using the default constructor.                  




      :param `parent`: The dialog parent, possibly ``None``.   
      :type `parent`: wx.Window
      :param `message`: The message shown inside the dialog itself, above the items list.   
      :type `message`: string
      :param `title`: The title of the dialog.   
      :type `title`: string
      :param `order`: The initial order of the items in the convention used by :ref:`wx.RearrangeList`.   
      :type `order`: list of integers
      :param `items`: The items to show in the dialog.   
      :type `items`: list of strings
      :param `pos`: Optional dialog position.   
      :type `pos`: wx.Point
      :param `name`: Optional dialog name.   
      :type `name`: string


















      :rtype: `bool`



                  



      :returns: 

         ``True`` if the dialog was successfully created or ``False`` if creation failed.   








   .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)




      :param `variant`: 
      :type `variant`: wx.WindowVariant




      :rtype: :ref:`wx.VisualAttributes`








   .. method:: GetList(self)

      Return the list control used by the dialog.                  

                

      :rtype: :ref:`wx.RearrangeList`







      .. seealso:: :meth:`wx.RearrangeCtrl.GetList`     








   .. method:: GetOrder(self)

      Return the array describing the order of items after it was modified by the user.                  

      Please notice that the array will contain negative items if any items were unchecked. See :ref:`wx.RearrangeList`  for more information about the convention used for this array.                  

      :rtype: `list of integers`








   .. attribute:: List

      See :meth:`~wx.RearrangeDialog.GetList`


   .. attribute:: Order

      See :meth:`~wx.RearrangeDialog.GetOrder`

