1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxListCtrl sample
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation
17 // For compilers that support precompilation, includes "wx/wx.h".
18 #include "wx/wxprec.h"
29 #include "mondrian.xpm"
31 #include "bitmaps/toolbrai.xpm"
32 #include "bitmaps/toolchar.xpm"
33 #include "bitmaps/tooldata.xpm"
34 #include "bitmaps/toolnote.xpm"
35 #include "bitmaps/tooltodo.xpm"
36 #include "bitmaps/toolchec.xpm"
37 #include "bitmaps/toolgame.xpm"
38 #include "bitmaps/tooltime.xpm"
39 #include "bitmaps/toolword.xpm"
40 #include "bitmaps/small1.xpm"
43 #include "wx/imaglist.h"
44 #include "wx/listctrl.h"
45 #include "wx/timer.h" // for wxStopWatch
46 #include "wx/colordlg.h" // for wxGetColourFromUser
50 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
51 EVT_MENU(BUSY_ON
, MyFrame::BusyOn
)
52 EVT_MENU(BUSY_OFF
, MyFrame::BusyOff
)
53 EVT_MENU(LIST_QUIT
, MyFrame::OnQuit
)
54 EVT_MENU(LIST_ABOUT
, MyFrame::OnAbout
)
55 EVT_MENU(LIST_LIST_VIEW
, MyFrame::OnListView
)
56 EVT_MENU(LIST_REPORT_VIEW
, MyFrame::OnReportView
)
57 EVT_MENU(LIST_ICON_VIEW
, MyFrame::OnIconView
)
58 EVT_MENU(LIST_ICON_TEXT_VIEW
, MyFrame::OnIconTextView
)
59 EVT_MENU(LIST_SMALL_ICON_VIEW
, MyFrame::OnSmallIconView
)
60 EVT_MENU(LIST_SMALL_ICON_TEXT_VIEW
, MyFrame::OnSmallIconTextView
)
61 EVT_MENU(LIST_TOGGLE_FIRST
, MyFrame::OnToggleFirstSel
)
62 EVT_MENU(LIST_DESELECT_ALL
, MyFrame::OnDeselectAll
)
63 EVT_MENU(LIST_SELECT_ALL
, MyFrame::OnSelectAll
)
64 EVT_MENU(LIST_DELETE_ALL
, MyFrame::OnDeleteAll
)
65 EVT_MENU(LIST_SORT
, MyFrame::OnSort
)
66 EVT_MENU(LIST_SET_FG_COL
, MyFrame::OnSetFgColour
)
67 EVT_MENU(LIST_SET_BG_COL
, MyFrame::OnSetBgColour
)
68 EVT_MENU(LIST_TOGGLE_MULTI_SEL
, MyFrame::OnToggleMultiSel
)
69 EVT_MENU(LIST_SHOW_COL_INFO
, MyFrame::OnShowColInfo
)
70 EVT_UPDATE_UI(LIST_SHOW_COL_INFO
, MyFrame::OnUpdateShowColInfo
)
73 BEGIN_EVENT_TABLE(MyListCtrl
, wxListCtrl
)
74 EVT_LIST_BEGIN_DRAG(LIST_CTRL
, MyListCtrl::OnBeginDrag
)
75 EVT_LIST_BEGIN_RDRAG(LIST_CTRL
, MyListCtrl::OnBeginRDrag
)
76 EVT_LIST_BEGIN_LABEL_EDIT(LIST_CTRL
, MyListCtrl::OnBeginLabelEdit
)
77 EVT_LIST_END_LABEL_EDIT(LIST_CTRL
, MyListCtrl::OnEndLabelEdit
)
78 EVT_LIST_DELETE_ITEM(LIST_CTRL
, MyListCtrl::OnDeleteItem
)
79 EVT_LIST_DELETE_ALL_ITEMS(LIST_CTRL
, MyListCtrl::OnDeleteAllItems
)
80 EVT_LIST_GET_INFO(LIST_CTRL
, MyListCtrl::OnGetInfo
)
81 EVT_LIST_SET_INFO(LIST_CTRL
, MyListCtrl::OnSetInfo
)
82 EVT_LIST_ITEM_SELECTED(LIST_CTRL
, MyListCtrl::OnSelected
)
83 EVT_LIST_ITEM_DESELECTED(LIST_CTRL
, MyListCtrl::OnDeselected
)
84 EVT_LIST_KEY_DOWN(LIST_CTRL
, MyListCtrl::OnListKeyDown
)
85 EVT_LIST_ITEM_ACTIVATED(LIST_CTRL
, MyListCtrl::OnActivated
)
86 EVT_LIST_COL_CLICK(LIST_CTRL
, MyListCtrl::OnColClick
)
88 EVT_CHAR(MyListCtrl::OnChar
)
93 int wxCALLBACK
MyCompareFunction(long item1
, long item2
, long sortData
)
99 // `Main program' equivalent, creating windows and returning main app frame
102 // Create the main frame window
103 MyFrame
*frame
= new MyFrame("wxListCtrl Test", 50, 50, 450, 340);
113 // My frame constructor
114 MyFrame::MyFrame(const wxChar
*title
, int x
, int y
, int w
, int h
)
115 : wxFrame((wxFrame
*)NULL
, -1, title
, wxPoint(x
, y
), wxSize(w
, h
))
117 m_listCtrl
= (MyListCtrl
*) NULL
;
118 m_logWindow
= (wxTextCtrl
*) NULL
;
121 SetIcon( wxICON(mondrian
) );
123 // Make an image list containing large icons
124 m_imageListNormal
= new wxImageList(32, 32, TRUE
);
125 m_imageListSmall
= new wxImageList(16, 16, TRUE
);
128 m_imageListNormal
->Add( wxIcon("icon1", wxBITMAP_TYPE_ICO_RESOURCE
) );
129 m_imageListNormal
->Add( wxIcon("icon2", wxBITMAP_TYPE_ICO_RESOURCE
) );
130 m_imageListNormal
->Add( wxIcon("icon3", wxBITMAP_TYPE_ICO_RESOURCE
) );
131 m_imageListNormal
->Add( wxIcon("icon4", wxBITMAP_TYPE_ICO_RESOURCE
) );
132 m_imageListNormal
->Add( wxIcon("icon5", wxBITMAP_TYPE_ICO_RESOURCE
) );
133 m_imageListNormal
->Add( wxIcon("icon6", wxBITMAP_TYPE_ICO_RESOURCE
) );
134 m_imageListNormal
->Add( wxIcon("icon7", wxBITMAP_TYPE_ICO_RESOURCE
) );
135 m_imageListNormal
->Add( wxIcon("icon8", wxBITMAP_TYPE_ICO_RESOURCE
) );
136 m_imageListNormal
->Add( wxIcon("icon9", wxBITMAP_TYPE_ICO_RESOURCE
) );
138 m_imageListSmall
->Add( wxIcon("iconsmall", wxBITMAP_TYPE_ICO_RESOURCE
) );
141 m_imageListNormal
->Add( wxIcon( toolbrai_xpm
) );
142 m_imageListNormal
->Add( wxIcon( toolchar_xpm
) );
143 m_imageListNormal
->Add( wxIcon( tooldata_xpm
) );
144 m_imageListNormal
->Add( wxIcon( toolnote_xpm
) );
145 m_imageListNormal
->Add( wxIcon( tooltodo_xpm
) );
146 m_imageListNormal
->Add( wxIcon( toolchec_xpm
) );
147 m_imageListNormal
->Add( wxIcon( toolgame_xpm
) );
148 m_imageListNormal
->Add( wxIcon( tooltime_xpm
) );
149 m_imageListNormal
->Add( wxIcon( toolword_xpm
) );
151 m_imageListSmall
->Add( wxIcon( small1_xpm
) );
155 wxMenu
*menuFile
= new wxMenu
;
156 menuFile
->Append(LIST_ABOUT
, "&About");
157 menuFile
->AppendSeparator();
158 #if 0 // what is this for? (VZ)
159 menuFile
->Append(BUSY_ON
, "&Busy cursor on");
160 menuFile
->Append(BUSY_OFF
, "&Busy cursor off");
161 menuFile
->AppendSeparator();
163 menuFile
->Append(LIST_QUIT
, "E&xit\tAlt-X");
165 wxMenu
*menuView
= new wxMenu
;
166 menuView
->Append(LIST_LIST_VIEW
, "&List view\tF1");
167 menuView
->Append(LIST_REPORT_VIEW
, "&Report view\tF2");
168 menuView
->Append(LIST_ICON_VIEW
, "&Icon view\tF3");
169 menuView
->Append(LIST_ICON_TEXT_VIEW
, "Icon view with &text\tF4");
170 menuView
->Append(LIST_SMALL_ICON_VIEW
, "&Small icon view\tF5");
171 menuView
->Append(LIST_SMALL_ICON_TEXT_VIEW
, "Small icon &view with text\tF6");
173 wxMenu
*menuList
= new wxMenu
;
174 menuList
->Append(LIST_TOGGLE_FIRST
, "&Toggle first item\tCtrl-T");
175 menuList
->Append(LIST_DESELECT_ALL
, "&Deselect All\tCtrl-D");
176 menuList
->Append(LIST_SELECT_ALL
, "S&elect All\tCtrl-A");
177 menuList
->Append(LIST_SHOW_COL_INFO
, "Show &column info\tCtrl-C");
178 menuList
->AppendSeparator();
179 menuList
->Append(LIST_SORT
, "&Sort\tCtrl-S");
180 menuList
->AppendSeparator();
181 menuList
->Append(LIST_DELETE_ALL
, "Delete &all items");
182 menuList
->AppendSeparator();
183 menuList
->Append(LIST_TOGGLE_MULTI_SEL
, "&Multiple selection\tCtrl-M",
184 "Toggle multiple selection", TRUE
);
186 wxMenu
*menuCol
= new wxMenu
;
187 menuCol
->Append(LIST_SET_FG_COL
, "&Foreground colour...");
188 menuCol
->Append(LIST_SET_BG_COL
, "&Background colour...");
190 wxMenuBar
*menubar
= new wxMenuBar
;
191 menubar
->Append(menuFile
, "&File");
192 menubar
->Append(menuView
, "&View");
193 menubar
->Append(menuList
, "&List");
194 menubar
->Append(menuCol
, "&Colour");
197 m_listCtrl
= new MyListCtrl(this, LIST_CTRL
,
198 wxDefaultPosition
, wxDefaultSize
,
202 // wxLC_USER_TEXT requires app to supply all
208 m_logWindow
= new wxTextCtrl(this, -1, wxEmptyString
,
209 wxDefaultPosition
, wxDefaultSize
,
210 wxTE_MULTILINE
| wxSUNKEN_BORDER
);
212 m_logOld
= wxLog::SetActiveTarget(new wxLogTextCtrl(m_logWindow
));
214 wxLayoutConstraints
*c
= new wxLayoutConstraints
;
215 c
->top
.SameAs (this, wxTop
);
216 c
->left
.SameAs (this, wxLeft
);
217 c
->right
.SameAs (this, wxRight
);
218 c
->height
.PercentOf (this, wxHeight
, 66);
219 m_listCtrl
->SetConstraints(c
);
221 c
= new wxLayoutConstraints
;
222 c
->top
.Below (m_listCtrl
);
223 c
->left
.SameAs (this, wxLeft
);
224 c
->right
.SameAs (this, wxRight
);
225 c
->bottom
.SameAs (this, wxBottom
);
226 m_logWindow
->SetConstraints(c
);
229 for ( int i
= 0; i
< 30; i
++ )
231 long idx
= m_listCtrl
->InsertItem(i
, wxString::Format(_T("Item %d"), i
));
232 m_listCtrl
->SetItemData(idx
, i
*i
);
240 delete wxLog::SetActiveTarget(m_logOld
);
242 delete m_imageListNormal
;
243 delete m_imageListSmall
;
246 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
251 void MyFrame::BusyOn(wxCommandEvent
& WXUNUSED(event
))
256 void MyFrame::BusyOff(wxCommandEvent
& WXUNUSED(event
))
261 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
263 wxMessageDialog
dialog(this, "List test sample\nJulian Smart (c) 1997",
264 "About list test", wxOK
|wxCANCEL
);
269 void MyFrame::OnToggleFirstSel(wxCommandEvent
& WXUNUSED(event
))
271 m_listCtrl
->SetItemState(0, wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
274 void MyFrame::OnDeselectAll(wxCommandEvent
& WXUNUSED(event
))
276 int n
= m_listCtrl
->GetItemCount();
277 for (int i
= 0; i
< n
; i
++)
278 m_listCtrl
->SetItemState(i
,0,wxLIST_STATE_SELECTED
);
281 void MyFrame::OnSelectAll(wxCommandEvent
& WXUNUSED(event
))
283 int n
= m_listCtrl
->GetItemCount();
284 for (int i
= 0; i
< n
; i
++)
285 m_listCtrl
->SetItemState(i
,wxLIST_STATE_SELECTED
, wxLIST_STATE_SELECTED
);
288 void MyFrame::OnListView(wxCommandEvent
& WXUNUSED(event
))
290 m_listCtrl
->ClearAll();
291 m_logWindow
->Clear();
293 m_listCtrl
->SetSingleStyle(wxLC_LIST
);
294 m_listCtrl
->SetImageList((wxImageList
*) NULL
, wxIMAGE_LIST_NORMAL
);
295 m_listCtrl
->SetImageList((wxImageList
*) NULL
, wxIMAGE_LIST_SMALL
);
297 for ( int i
=0; i
< 30; i
++)
300 wxSprintf(buf
, _T("Item %d"), i
);
301 m_listCtrl
->InsertItem(i
, buf
);
305 void MyFrame::OnReportView(wxCommandEvent
& WXUNUSED(event
))
307 m_logWindow
->Clear();
308 m_listCtrl
->ClearAll();
310 m_listCtrl
->SetSingleStyle(wxLC_REPORT
);
311 m_listCtrl
->SetImageList((wxImageList
*) NULL
, wxIMAGE_LIST_NORMAL
);
312 m_listCtrl
->SetImageList(m_imageListSmall
, wxIMAGE_LIST_SMALL
);
314 m_listCtrl
->InsertColumn(0, "Column 1"); // , wxLIST_FORMAT_LEFT, 140);
315 m_listCtrl
->InsertColumn(1, "Column 2"); // , wxLIST_FORMAT_LEFT, 140);
316 m_listCtrl
->InsertColumn(2, "One More Column (2)"); // , wxLIST_FORMAT_LEFT, 140);
318 // to speed up inserting we hide the control temporarily
324 static const int NUM_ITEMS
= 30;//00;
325 for ( int i
= 0; i
< NUM_ITEMS
; i
++ )
327 buf
.Printf(_T("This is item %d"), i
);
328 long tmp
= m_listCtrl
->InsertItem(i
, buf
, 0);
329 m_listCtrl
->SetItemData(tmp
, i
);
331 buf
.Printf(_T("Col 1, item %d"), i
);
332 tmp
= m_listCtrl
->SetItem(i
, 1, buf
);
334 buf
.Printf(_T("Item %d in column 2"), i
);
335 tmp
= m_listCtrl
->SetItem(i
, 2, buf
);
338 m_logWindow
->WriteText(wxString::Format(_T("%d items inserted in %ldms\n"),
339 NUM_ITEMS
, sw
.Time()));
342 // we leave all mask fields to 0 and only change the colour
345 item
.SetTextColour(*wxRED
);
346 m_listCtrl
->SetItem( item
);
349 item
.SetTextColour(*wxGREEN
);
350 m_listCtrl
->SetItem( item
);
352 item
.SetTextColour(*wxLIGHT_GREY
);
353 item
.SetFont(*wxITALIC_FONT
);
354 item
.SetBackgroundColour(*wxRED
);
355 m_listCtrl
->SetItem( item
);
357 m_listCtrl
->SetTextColour(*wxBLUE
);
358 m_listCtrl
->SetBackgroundColour(*wxLIGHT_GREY
);
360 m_listCtrl
->SetColumnWidth( 0, wxLIST_AUTOSIZE
);
361 m_listCtrl
->SetColumnWidth( 1, wxLIST_AUTOSIZE
);
362 m_listCtrl
->SetColumnWidth( 2, wxLIST_AUTOSIZE
);
365 void MyFrame::OnIconView(wxCommandEvent
& WXUNUSED(event
))
367 m_logWindow
->Clear();
368 m_listCtrl
->ClearAll();
370 m_listCtrl
->SetSingleStyle(wxLC_ICON
);
371 m_listCtrl
->SetImageList(m_imageListNormal
, wxIMAGE_LIST_NORMAL
);
372 m_listCtrl
->SetImageList(m_imageListSmall
, wxIMAGE_LIST_SMALL
);
374 for ( int i
=0; i
< 9; i
++)
376 m_listCtrl
->InsertItem(i
, i
);
380 void MyFrame::OnIconTextView(wxCommandEvent
& WXUNUSED(event
))
382 m_logWindow
->Clear();
383 m_listCtrl
->ClearAll();
385 m_listCtrl
->SetSingleStyle(wxLC_ICON
);
386 m_listCtrl
->SetImageList(m_imageListNormal
, wxIMAGE_LIST_NORMAL
);
387 m_listCtrl
->SetImageList(m_imageListSmall
, wxIMAGE_LIST_SMALL
);
389 for ( int i
=0; i
< 9; i
++)
392 wxSprintf(buf
, _T("Label %d"), i
);
393 m_listCtrl
->InsertItem(i
, buf
, i
);
397 void MyFrame::OnSmallIconView(wxCommandEvent
& WXUNUSED(event
))
399 m_logWindow
->Clear();
400 m_listCtrl
->ClearAll();
402 m_listCtrl
->SetSingleStyle(wxLC_SMALL_ICON
);
403 m_listCtrl
->SetImageList(m_imageListNormal
, wxIMAGE_LIST_NORMAL
);
404 m_listCtrl
->SetImageList(m_imageListSmall
, wxIMAGE_LIST_SMALL
);
406 for ( int i
=0; i
< 9; i
++)
408 m_listCtrl
->InsertItem(i
, 0);
412 void MyFrame::OnSmallIconTextView(wxCommandEvent
& WXUNUSED(event
))
414 m_logWindow
->Clear();
415 m_listCtrl
->ClearAll();
417 m_listCtrl
->SetSingleStyle(wxLC_SMALL_ICON
);
418 m_listCtrl
->SetImageList(m_imageListNormal
, wxIMAGE_LIST_NORMAL
);
419 m_listCtrl
->SetImageList(m_imageListSmall
, wxIMAGE_LIST_SMALL
);
421 for ( int i
=0; i
< 9; i
++)
423 m_listCtrl
->InsertItem(i
, "Label", 0);
427 void MyFrame::OnSort(wxCommandEvent
& WXUNUSED(event
))
431 m_listCtrl
->SortItems(MyCompareFunction
, 0);
433 m_logWindow
->WriteText(wxString::Format(_T("Sorting %d items took %ld ms\n"),
434 m_listCtrl
->GetItemCount(),
438 void MyFrame::OnShowColInfo(wxCommandEvent
& event
)
440 int count
= m_listCtrl
->GetColumnCount();
441 wxLogMessage("%d columns:", count
);
442 for ( int c
= 0; c
< count
; c
++ )
444 wxLogMessage("\tcolumn %d has width %d", c
,
445 m_listCtrl
->GetColumnWidth(c
));
449 void MyFrame::OnUpdateShowColInfo(wxUpdateUIEvent
& event
)
451 event
.Enable( (m_listCtrl
->GetWindowStyleFlag() & wxLC_REPORT
) != 0 );
454 void MyFrame::OnToggleMultiSel(wxCommandEvent
& WXUNUSED(event
))
456 m_logWindow
->WriteText("Current selection mode: ");
458 long flags
= m_listCtrl
->GetWindowStyleFlag();
459 if ( flags
& wxLC_SINGLE_SEL
)
461 m_listCtrl
->SetWindowStyleFlag(flags
& ~wxLC_SINGLE_SEL
);
462 m_logWindow
->WriteText("multiple");
466 m_listCtrl
->SetWindowStyleFlag(flags
| wxLC_SINGLE_SEL
);
467 m_logWindow
->WriteText("single");
470 m_logWindow
->WriteText("\nRecreate the control now\n");
473 void MyFrame::OnSetFgColour(wxCommandEvent
& WXUNUSED(event
))
475 m_listCtrl
->SetForegroundColour(wxGetColourFromUser(this));
476 m_listCtrl
->Refresh();
479 void MyFrame::OnSetBgColour(wxCommandEvent
& WXUNUSED(event
))
481 m_listCtrl
->SetBackgroundColour(wxGetColourFromUser(this));
482 m_listCtrl
->Refresh();
485 void MyFrame::OnDeleteAll(wxCommandEvent
& WXUNUSED(event
))
489 m_listCtrl
->DeleteAllItems();
491 m_logWindow
->WriteText(wxString::Format(_T("Deleting %d items took %ld ms\n"),
492 m_listCtrl
->GetItemCount(),
498 void MyListCtrl::OnColClick(wxListEvent
& event
)
500 wxLogMessage( "OnColumnClick at %d.", event
.GetColumn() );
503 void MyListCtrl::OnBeginDrag(wxListEvent
& event
)
505 wxLogMessage( "OnBeginDrag at %d,%d.",
506 event
.m_pointDrag
.x
, event
.m_pointDrag
.y
);
509 void MyListCtrl::OnBeginRDrag(wxListEvent
& event
)
511 wxLogMessage( "OnBeginRDrag at %d,%d.",
512 event
.m_pointDrag
.x
, event
.m_pointDrag
.y
);
515 void MyListCtrl::OnBeginLabelEdit(wxListEvent
& event
)
517 wxLogMessage("OnBeginLabelEdit: %s", event
.m_item
.m_text
.c_str());
520 void MyListCtrl::OnEndLabelEdit(wxListEvent
& event
)
522 wxLogMessage("OnEndLabelEdit: %s", event
.m_item
.m_text
.c_str());
525 void MyListCtrl::OnDeleteItem(wxListEvent
& event
)
527 LogEvent(event
, _T("OnDeleteItem"));
530 void MyListCtrl::OnDeleteAllItems(wxListEvent
& event
)
532 LogEvent(event
, _T("OnDeleteAllItems"));
535 void MyListCtrl::OnGetInfo(wxListEvent
& event
)
539 msg
<< "OnGetInfo (" << event
.m_item
.m_itemId
<< ", " << event
.m_item
.m_col
<< ")";
540 if ( event
.m_item
.m_mask
& wxLIST_MASK_STATE
)
541 msg
<< " wxLIST_MASK_STATE";
542 if ( event
.m_item
.m_mask
& wxLIST_MASK_TEXT
)
543 msg
<< " wxLIST_MASK_TEXT";
544 if ( event
.m_item
.m_mask
& wxLIST_MASK_IMAGE
)
545 msg
<< " wxLIST_MASK_IMAGE";
546 if ( event
.m_item
.m_mask
& wxLIST_MASK_DATA
)
547 msg
<< " wxLIST_MASK_DATA";
548 if ( event
.m_item
.m_mask
& wxLIST_SET_ITEM
)
549 msg
<< " wxLIST_SET_ITEM";
550 if ( event
.m_item
.m_mask
& wxLIST_MASK_WIDTH
)
551 msg
<< " wxLIST_MASK_WIDTH";
552 if ( event
.m_item
.m_mask
& wxLIST_MASK_FORMAT
)
553 msg
<< " wxLIST_MASK_WIDTH";
555 if ( event
.m_item
.m_mask
& wxLIST_MASK_TEXT
)
557 event
.m_item
.m_text
= "My callback text";
563 void MyListCtrl::OnSetInfo(wxListEvent
& event
)
565 LogEvent(event
, _T("OnSetInfo"));
568 void MyListCtrl::OnSelected(wxListEvent
& event
)
570 LogEvent(event
, _T("OnSelected"));
572 if ( GetWindowStyle() & wxLC_REPORT
)
575 info
.m_itemId
= event
.m_itemIndex
;
577 info
.m_mask
= wxLIST_MASK_TEXT
;
580 wxLogMessage("Value of the 2nd field of the selected item: %s",
581 info
.m_text
.c_str());
585 wxFAIL_MSG("wxListCtrl::GetItem() failed");
590 void MyListCtrl::OnDeselected(wxListEvent
& event
)
592 LogEvent(event
, _T("OnDeselected"));
595 void MyListCtrl::OnActivated(wxListEvent
& event
)
597 LogEvent(event
, _T("OnActivated"));
600 void MyListCtrl::OnListKeyDown(wxListEvent
& event
)
602 LogEvent(event
, _T("OnListKeyDown"));
607 void MyListCtrl::OnChar(wxKeyEvent
& event
)
609 wxLogMessage(_T("Got char event."));
614 void MyListCtrl::LogEvent(const wxListEvent
& event
, const wxChar
*eventName
)
616 wxLogMessage(_T("Item %ld: %s (item text = %s, data = %ld)"),
617 event
.GetIndex(), eventName
,
618 event
.GetText().c_str(), event
.GetData());