]> git.saurik.com Git - wxWidgets.git/commitdiff
Add simple wxListCtrl to complex sample
authorRobert Roebling <robert@roebling.de>
Fri, 23 Jan 2009 12:26:30 +0000 (12:26 +0000)
committerRobert Roebling <robert@roebling.de>
Fri, 23 Jan 2009 12:26:30 +0000 (12:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/listctrl/listtest.cpp
samples/listctrl/listtest.h

index 497cc83cbdf20ac37a97146ebeb2c9cdddaca676..162d2b7d1f831afca0bf14389b4ca996d878bd05 100644 (file)
@@ -171,10 +171,11 @@ bool MyApp::OnInit()
 
 // My frame constructor
 MyFrame::MyFrame(const wxChar *title)
-       : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500))
+       : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(800, 500))
 {
     m_listCtrl = NULL;
     m_logWindow = NULL;
+    m_simpleListCtrl = NULL;
     m_smallVirtual = false;
 
     // Give it an icon
@@ -278,7 +279,26 @@ MyFrame::MyFrame(const wxChar *title)
     m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_logWindow));
 
     RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL);
-
+    
+    // Also add a simple list to the sample
+   
+    m_simpleListCtrl = new wxListCtrl( m_panel, -1, wxDefaultPosition, wxDefaultSize, 
+                                       wxLC_REPORT | wxLC_SINGLE_SEL );
+    m_simpleListCtrl->InsertColumn(0, "Column 1", wxLIST_FORMAT_LEFT, 80);
+    m_simpleListCtrl->InsertColumn(1, "Column 2", wxLIST_FORMAT_LEFT, 100);
+    m_simpleListCtrl->InsertColumn(2, "Column 3", wxLIST_FORMAT_LEFT, 100);
+    
+    for ( int i = 0; i < NUM_ITEMS; i++ )
+    {
+        wxString buf;
+        buf.Printf(_T("Item %d"), i);
+        long tmp = m_simpleListCtrl->InsertItem(i, buf, 0);
+        buf.Printf(_T("Col 1, item %d"), i);
+        m_simpleListCtrl->SetItem(tmp, 1, buf);
+        buf.Printf(_T("Col 2, item %d"), i);
+        m_simpleListCtrl->SetItem(tmp, 2, buf);
+    }
+    
 #if wxUSE_STATUSBAR
     CreateStatusBar();
 #endif // wxUSE_STATUSBAR
@@ -306,7 +326,8 @@ void MyFrame::DoSize()
 
     wxSize size = GetClientSize();
     wxCoord y = (2*size.y)/3;
-    m_listCtrl->SetSize(0, 0, size.x, y);
+    m_listCtrl->SetSize(0, 0, size.x-320, y);
+    if (m_simpleListCtrl) m_simpleListCtrl->SetSize(size.x-320+1, 0, 320-1, y);
     m_logWindow->SetSize(0, y + 1, size.x, size.y - y);
 }
 
index e203f8f5f887bfb8d056dc2e7d055f86e560a073..26e1c6cf07ee20cfadb48f8d3a60ad2ddc524116 100644 (file)
@@ -153,6 +153,7 @@ protected:
 
     wxPanel *m_panel;
     MyListCtrl *m_listCtrl;
+    wxListCtrl *m_simpleListCtrl;
     wxTextCtrl *m_logWindow;
 
 private: