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