Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxTabCtrl

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxTabCtrl
#4904
Posted by: 2004-07-29 00:09:26
Hello every one,

I think I found a solution in changing the appearance of the tabs in a notebook. Well, actually it is not using wxnotebook but wxTabCtrl which has functions to allow that. I did not find an example in the sample about how to use wxTabCtrl and I'm trying something out but it doesn't display the Tab:

wxTabsFrame::wxTabsFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style)
       : wxFrame((wxFrame *)NULL, -1, title, pos, size, style)
{
    // set the frame icon
    SetIcon(wxICON(wxTabs));

    wxTabCtrl *tab = new wxTabCtrl(this,-1,wxDefaultPosition, wxDefaultSize, 0);

   tab->InsertItem(1, "text");
   tab->SetBackgroundColour(wxColour(  100, 100, 100 ));
   tab->Show(true);

   tab->InsertItem(1, "text 2");
   tab->Show(true);

    // create controls
    wxPanel *panel = new wxPanel(this, -1);
  
    panel = new wxPanel(tab);
    panel->SetAutoLayout( TRUE );

    wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );      
    wxBoxSizer *m_hsizer = new wxBoxSizer( wxHORIZONTAL );
    wxBoxSizer *m_buttonSizer = new wxBoxSizer (wxVERTICAL);
   
    wxButton *m_sizerBtn1 = new wxButton(panel, -1, _T("Test Button &1") );
    m_buttonSizer->Add( m_sizerBtn1, 0, wxALL, 10 ); 
    wxButton *m_sizerBtn2 = new wxButton(panel, -1, _T("Test Button &2") );
    m_buttonSizer->Add( m_sizerBtn2, 0, wxALL, 10 ); 

    m_hsizer->Add (m_buttonSizer);
    sizer->Add (m_hsizer, 1, wxGROW);

    panel->SetSizer( sizer );

}

----------------------------------------------
After getting the tabs as I want, I have to stick each panel to the appropriate one and be able to manage it. I think the function below will take care of that but I'm not sure how yet...

wxTabCtrl::SetItemData
bool SetItemData(int item, void* data)

Sets the client data for a tab.

thx, moons
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2021-7-28  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0