X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..f63e3ebbe3272b9690aa2530e0c3048d3f37c7c7:/wxPython/demo/wxCheckListBox.py diff --git a/wxPython/demo/wxCheckListBox.py b/wxPython/demo/wxCheckListBox.py index 4727459b0c..4a0fd024c7 100644 --- a/wxPython/demo/wxCheckListBox.py +++ b/wxPython/demo/wxCheckListBox.py @@ -13,13 +13,19 @@ class TestPanel(wxPanel): 'twelve', 'thirteen', 'fourteen'] wxStaticText(self, -1, "This example uses the wxCheckListBox control.", - wxPoint(45, 15)) + (45, 15)) - lb = wxCheckListBox(self, 60, wxPoint(80, 50), wxSize(80, 120), + lb = wxCheckListBox(self, 60, (80, 50), (80, 120), sampleList) EVT_LISTBOX(self, 60, self.EvtListBox) EVT_LISTBOX_DCLICK(self, 60, self.EvtListBoxDClick) lb.SetSelection(0) + self.lb = lb + + btn = wxButton(self, -1, "Test SetString", (180, 50)) + EVT_BUTTON(self, btn.GetId(), self.OnTestButton) + + EVT_RIGHT_UP(self, self.OnDoPopup) def EvtListBox(self, event): @@ -28,6 +34,28 @@ class TestPanel(wxPanel): def EvtListBoxDClick(self, event): self.log.WriteText('EvtListBoxDClick:\n') + def OnTestButton(self, evt): + self.lb.SetString(4, "FUBAR") + + + def OnDoPopup(self, evt): + menu = wxMenu() + # Make this first item bold + item = wxMenuItem(menu, wxNewId(), "If supported, this is bold") + df = wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT) + nf = wxFont(df.GetPointSize(), df.GetFamily(), df.GetStyle(), wxBOLD, + false, df.GetFaceName()) + item.SetFont(nf) + menu.AppendItem(item) + + menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &1")) + menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &2")) + menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &3")) + menu.AppendItem(wxMenuItem(menu, wxNewId(), "Normal Item &4")) + + self.PopupMenu(menu, evt.GetPosition()) + menu.Destroy() + evt.Skip() #----------------------------------------------------------------------