]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxEditableListBox.py
Updated the description of wx.PopupTransientWindow
[wxWidgets.git] / wxPython / demo / wxEditableListBox.py
1 # 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 # o Added overview text based on source code delving.
5 #
6
7 import wx
8 import wx.gizmos as gizmos
9
10 #----------------------------------------------------------------------
11
12 class TestPanel(wx.Panel):
13 def __init__(self, parent, log):
14 wx.Panel.__init__(self, parent, -1)
15 self.log = log
16
17 self.elb = gizmos.EditableListBox(
18 self, -1, "List of Stuff", (50,50), (250, 250)
19 )
20 #style=wx.EL_ALLOW_NEW | wx.EL_ALLOW_EDIT | wx.EL_ALLOW_DELETE)
21
22 self.elb.SetStrings(["This is a nifty ListBox widget",
23 "that is editable by the user.",
24 "",
25 "Use the buttons above to",
26 "manipulate items in the list",
27 "Or to add new ones.",
28 ])
29
30
31
32 #----------------------------------------------------------------------
33
34 def runTest(frame, nb, log):
35 win = TestPanel(nb, log)
36 return win
37
38 #----------------------------------------------------------------------
39
40
41
42 overview = """\
43 <html>
44 <body>
45 This class provides a composite control that lets the user easily enter and edit
46 a list of strings.
47
48 <p><b>Styles supported:</b><p>
49
50 <ul>
51 <li><b>EL_ALLOW_NEW</b> - Allow user to create new items.
52 <li><b>EL_ALLOW_EDIT</b> - Allow user to edit text in the control.
53 <li><b>EL_ALLOW_DELETE</b> - Allow user to delete text from the control.
54 </ul>
55
56 <p><b>Init:</b>
57 <pre>
58 EditableListBox(wxWindow *parent, wxWindowID id=-1,
59 const wxString& label,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = EL_ALLOW_NEW | EL_ALLOW_EDIT | EL_ALLOW_DELETE,
63 const wxString& name = "editableListBox")
64 </pre>
65
66 <p><b>Methods:</b>
67 <ul>
68 <li><b>SetStrings(const wxArrayString& strings)</b> - Set an array of strings
69 into the control. <b>Note</b>: The wxPython method accepts a Python list instead
70 of an array of strings.
71
72 <li><b>void GetStrings(wxArrayString& strings)</b> - Retrieves an array
73 of strings from the control. The wxPython version returns a list of strings.
74
75 <li><b>GetListCtrl()</b> - Retrieves a reference to the actual list control
76 portion of the custom control.
77
78 <li><b>GetDelButton()</b> - Retrieves a reference to the BitmapButton that is used
79 as the 'delete' button in the control.
80
81 <li><b>GetNewButton()</b> - Retrieves a reference to the BitmapButton that is used
82 as the 'new' button in the control.
83
84 <li><b>GetUpButton()</b> - Retrieves a reference to the BitmapButton that is used
85 as the 'up' button in the control.
86
87 <li><b>GetDownButton()</b> - Retrieves a reference to the BitmapButton that is used
88 as the 'down' button in the control.
89
90 <li><b>GetEditButton()</b> - Retrieves a reference to the BitmapButton that is used
91 as the 'edit' button in the control.
92 </ul>
93 </body>
94 </html>
95 """
96
97
98 if __name__ == '__main__':
99 import sys,os
100 import run
101 run.main(['', os.path.basename(sys.argv[0])])
102