]>
Commit | Line | Data |
---|---|---|
cf694132 RD |
1 | |
2 | from wxPython.wx import * | |
3 | ||
4 | #--------------------------------------------------------------------------- | |
5 | ||
6 | class TestComboBox(wxPanel): | |
7 | def __init__(self, parent, log): | |
8 | self.log = log | |
9 | wxPanel.__init__(self, parent, -1) | |
10 | ||
11 | sampleList = ['zero', 'one', 'two', 'three', 'four', 'five', | |
12 | 'six', 'seven', 'eight'] | |
13 | ||
14 | wxStaticText(self, -1, "This example uses the wxComboBox control.", | |
15 | wxPoint(8, 10)) | |
16 | ||
17 | wxStaticText(self, -1, "Select one:", wxPoint(15, 50), wxSize(75, 18)) | |
f581a26d | 18 | wxComboBox(self, 500, "default value", wxPoint(80, 50), wxSize(95, -1), |
cf694132 | 19 | sampleList, wxCB_DROPDOWN) |
8bf5d46e | 20 | EVT_COMBOBOX(self, 500, self.EvtComboBox) |
cf694132 RD |
21 | |
22 | ||
23 | def EvtComboBox(self, event): | |
24 | self.log.WriteText('EvtComboBox: %s\n' % event.GetString()) | |
25 | ||
26 | #--------------------------------------------------------------------------- | |
27 | ||
28 | def runTest(frame, nb, log): | |
29 | win = TestComboBox(nb, log) | |
30 | return win | |
31 | ||
32 | #--------------------------------------------------------------------------- | |
33 | ||
34 | ||
35 | ||
36 | ||
37 | ||
38 | ||
39 | ||
40 | ||
41 | ||
42 | ||
43 | ||
44 | ||
45 | overview = """\ | |
46 | A combobox is like a combination of an edit control and a listbox. It can be displayed as static list with editable or read-only text field; or a drop-down list with text field; or a drop-down list without a text field. | |
47 | ||
48 | A combobox permits a single selection only. Combobox items are numbered from zero. | |
49 | ||
50 | wxComboBox() | |
51 | ----------------------- | |
52 | ||
53 | Default constructor. | |
54 | ||
55 | wxComboBox(wxWindow* parent, wxWindowID id, const wxString& value = "", const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n, const wxString choices[], long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "comboBox") | |
56 | ||
57 | Constructor, creating and showing a combobox. | |
58 | ||
59 | Parameters | |
60 | ------------------- | |
61 | ||
62 | parent = Parent window. Must not be NULL. | |
63 | ||
64 | id = Window identifier. A value of -1 indicates a default value. | |
65 | ||
66 | pos = Window position. | |
67 | ||
68 | size = Window size. If the default size (-1, -1) is specified then the window is sized appropriately. | |
69 | ||
70 | n = Number of strings with which to initialise the control. | |
71 | ||
72 | choices = An array of strings with which to initialise the control. | |
73 | ||
74 | style = Window style. See wxComboBox. | |
75 | ||
76 | validator = Window validator. | |
77 | ||
78 | name = Window name. | |
79 | """ |