0
|
1 // Filename : testframe.cpp
|
|
2 // Last Change: 08-Oct-2011.
|
|
3 //
|
|
4 #include "common.h"
|
|
5
|
|
6 class TestFrame : public wxFrame
|
|
7 {
|
|
8 DECLARE_EVENT_TABLE()
|
|
9 private:
|
|
10 wxListCtrl* m_listCtrl;
|
|
11
|
|
12 public:
|
|
13 TestFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCLOSE_BOX );
|
|
14 ~TestFrame();
|
|
15
|
|
16 void OnMessage(wxListEvent&);
|
|
17 };
|
|
18
|
|
19 // constructor
|
|
20 TestFrame::TestFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style )
|
|
21 : wxFrame( parent, id, title, pos, size, style )
|
|
22 {
|
|
23 this->SetSize( 400, 600 );
|
|
24 this->SetBackgroundColour( wxColour(wxT("WHEAT")) );
|
|
25
|
|
26 wxBoxSizer* bSizer;
|
|
27 bSizer = new wxBoxSizer( wxVERTICAL );
|
|
28
|
|
29 m_listCtrl = new wxListCtrl( this, ID_LSWHITE, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
|
|
30 wxListItem itemCol;
|
|
31 itemCol.SetText( wxT("通番") );
|
|
32 m_listCtrl->InsertColumn( 0, itemCol );
|
|
33 m_listCtrl->SetColumnWidth( 0, 100 );
|
|
34 itemCol.SetText( wxT("被保険者番号") );
|
|
35 m_listCtrl->InsertColumn( 1, itemCol );
|
|
36 m_listCtrl->SetColumnWidth( 1, 180 );
|
|
37 itemCol.SetText( wxT("ファイル数") );
|
|
38 m_listCtrl->InsertColumn( 2, itemCol );
|
|
39 m_listCtrl->SetColumnWidth( 1, 100 );
|
|
40 bSizer->Add( m_listCtrl, 1, wxALL|wxEXPAND, 5 );
|
|
41
|
|
42 this->SetSizer( bSizer );
|
|
43 this->Layout();
|
|
44
|
|
45 this->Centre( wxBOTH );
|
|
46
|
|
47 m_listCtrl->InsertItem( 1, wxT("aaa") );
|
|
48 m_listCtrl->SetItem( 0, 1, wxT("bbb"), -1 );
|
|
49 m_listCtrl->InsertItem( 1, wxT("aa2") );
|
|
50 m_listCtrl->SetItem( 1, 1, wxT("bb2"), -1 );
|
|
51 }
|
|
52
|
|
53 // destructor
|
|
54 TestFrame::~TestFrame()
|
|
55 {
|
|
56 }
|
|
57
|
|
58 // Event Table
|
|
59 BEGIN_EVENT_TABLE( TestFrame, wxFrame )
|
|
60 EVT_LIST_ITEM_ACTIVATED( ID_LSWHITE, TestFrame::OnMessage )
|
|
61 END_EVENT_TABLE()
|
|
62
|
|
63 // Event Handlers
|
|
64 void TestFrame::OnMessage(wxListEvent& event)
|
|
65 {
|
|
66 wxListItem item = event.GetItem();
|
|
67 item.SetColumn(1);
|
|
68 item.SetMask(wxLIST_MASK_TEXT);
|
|
69 //int n = item.GetColumn();
|
|
70 //wxString msg_n = wxString::Format(wxT("%d"),n);
|
|
71 //wxMessageBox( msg_n );
|
|
72 m_listCtrl->GetItem( item );
|
|
73 wxString msg = item.GetText();
|
|
74 wxMessageBox( msg );
|
|
75 }
|
|
76
|