]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxCheckListBox.py
New ErrorDialogs from Chris Fama
[wxWidgets.git] / wxPython / demo / wxCheckListBox.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4#----------------------------------------------------------------------
5
6class TestPanel(wxPanel):
7 def __init__(self, parent, log):
8 wxPanel.__init__(self, parent, -1)
9 self.log = log
10
11 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
12 'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
13 'twelve', 'thirteen', 'fourteen']
14
15 wxStaticText(self, -1, "This example uses the wxCheckListBox control.",
16 wxPoint(45, 15))
17
18 lb = wxCheckListBox(self, 60, wxPoint(80, 50), wxSize(80, 120),
19 sampleList)
20 EVT_LISTBOX(self, 60, self.EvtListBox)
21 EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
22 lb.SetSelection(0)
23
25832b3f
RD
24 EVT_RIGHT_UP(self, self.OnDoPopup)
25
cf694132
RD
26
27 def EvtListBox(self, event):
28 self.log.WriteText('EvtListBox: %s\n' % event.GetString())
29
30 def EvtListBoxDClick(self, event):
31 self.log.WriteText('EvtListBoxDClick:\n')
32
25832b3f
RD
33 def OnDoPopup(self, evt):
34 menu = wxMenu()
35 # Make this first item bold
1fb264fd 36 item = wxMenuItem(menu, wxNewId(), "If supported, this is &bold")
25832b3f
RD
37 df = wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT)
38 nf = wxFont(df.GetPointSize(), df.GetFamily(), df.GetStyle(), wxBOLD,
39 false, df.GetFaceName())
40 item.SetFont(nf)
41 menu.AppendItem(item)
42
1fb264fd
RD
43 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &1"))
44 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &2"))
45 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &3"))
46 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &4"))
25832b3f
RD
47
48 self.PopupMenu(menu, evt.GetPosition())
49 menu.Destroy()
50 evt.Skip()
cf694132
RD
51
52
53#----------------------------------------------------------------------
54
55def runTest(frame, nb, log):
56 win = TestPanel(nb, log)
57 return win
58
59#----------------------------------------------------------------------
60
61
62
63
64
65
66
67
68
69
70overview = """\
71"""
72
73