]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxCheckListBox.py
fix text scrolling in GTK2 (patch 703988)
[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.",
be43cc44 16 (45, 15))
cf694132 17
be43cc44 18 lb = wxCheckListBox(self, 60, (80, 50), (80, 120),
cf694132
RD
19 sampleList)
20 EVT_LISTBOX(self, 60, self.EvtListBox)
21 EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick)
22 lb.SetSelection(0)
be43cc44
RD
23 self.lb = lb
24
1e4a197e
RD
25 pos = lb.GetPosition().x + lb.GetSize().width + 25
26 btn = wxButton(self, -1, "Test SetString", (pos, 50))
be43cc44 27 EVT_BUTTON(self, btn.GetId(), self.OnTestButton)
cf694132 28
25832b3f
RD
29 EVT_RIGHT_UP(self, self.OnDoPopup)
30
cf694132
RD
31
32 def EvtListBox(self, event):
33 self.log.WriteText('EvtListBox: %s\n' % event.GetString())
34
35 def EvtListBoxDClick(self, event):
36 self.log.WriteText('EvtListBoxDClick:\n')
37
be43cc44
RD
38 def OnTestButton(self, evt):
39 self.lb.SetString(4, "FUBAR")
40
41
25832b3f
RD
42 def OnDoPopup(self, evt):
43 menu = wxMenu()
44 # Make this first item bold
611dc22c 45 item = wxMenuItem(menu, wxNewId(), "If supported, this is bold")
25832b3f
RD
46 df = wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT)
47 nf = wxFont(df.GetPointSize(), df.GetFamily(), df.GetStyle(), wxBOLD,
1e4a197e 48 False, df.GetFaceName())
25832b3f
RD
49 item.SetFont(nf)
50 menu.AppendItem(item)
51
1fb264fd
RD
52 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &1"))
53 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &2"))
54 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &3"))
55 menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &4"))
25832b3f
RD
56
57 self.PopupMenu(menu, evt.GetPosition())
58 menu.Destroy()
59 evt.Skip()
cf694132
RD
60
61
62#----------------------------------------------------------------------
63
64def runTest(frame, nb, log):
65 win = TestPanel(nb, log)
66 return win
67
68#----------------------------------------------------------------------
69
70
71
72
1fded56b
RD
73overview = """\
74"""
cf694132
RD
75
76
77
78
79
1fded56b
RD
80if __name__ == '__main__':
81 import sys,os
82 import run
83 run.main(['', os.path.basename(sys.argv[0])])
cf694132 84