Kirix Support Forums

updating tabbed pages's content

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

updating tabbed pages's content

Postby bajra on Thu Jul 17, 2008 11:04 am

hi,
i would like to know how its possible to update the contents of a wxauinotebook page.
i have a notebook page inside a pane managed by wxauimanager and i would like to change the contents of that page when user clicks on a toolbar menu.any idea guys ?

thanks
bajra
Registered User
 
Posts: 2
Joined: Thu Jun 05, 2008 11:26 am

Re: updating tabbed pages's content

Postby R.U.10 on Fri Jul 18, 2008 3:51 am

Hello,

You can simply access the notebook page through the selected notebook tab number with the function GetPage(), modify what you want on the page then call Update() on the notebook page and the AuiManager.

If you want to modify all the page content, the various contents of the notebook page could be defined in some child windows (eg. wxPanel), each one managed by a wxAuiPaneInfo. Overload your notebook page class to add it a wxAuiManager. In that overloaded class, connect a function on the expected menu item selection event. In that function you can manage the notebook page content through the children's PanInfo (CentrePane(), Show(), etc.) then finally Update() the notebook page's AuiManager.

Take a look on the documentation of wxAuiNotebook, wxAuiManager and wxAuiPaneInfo.

Regards
R.U.10
Registered User
 
Posts: 30
Joined: Mon May 21, 2007 9:26 am

Re: updating tabbed pages's content

Postby bajra on Sat Jul 19, 2008 10:43 am

hi,
thanks for the reply.
i am a beginner in wx.it would help me alot if you can produce some code samples.
i had tried GetPage() but couldn't make it work.

could you complete the code below:
Code: Select all
//get selected page ID
//myTabs is the wxAuiNoteBook object
int selPageId=myTabs->GetSelection();
wxWindow* thisPage=myTabs->GetPage(selPageId);
.......
// now what ??
// how do i access and modify a control (lets suppose modifying wxTextCtrl's value placed in this page)   
.......
myManager->Update();
bajra
Registered User
 
Posts: 2
Joined: Thu Jun 05, 2008 11:26 am

Re: updating tabbed pages's content

Postby R.U.10 on Mon Jul 21, 2008 4:15 am

Hello,

Here is a simple sample:

Code: Select all
//get selected page ID
//myTabs is the wxAuiNoteBook object
int selPageId=myTabs->GetSelection();
wxWindow* thisPage=myTabs->GetPage(selPageId);

if (thisPage != NULL)
{
    wxWindow* theCtrl = thisPage->FindWindow(wxT("the ctrl name")/or the ctrl ID);
    if (theCtrl != NULL)
    {
        wxTextCtrl *theTextCtrl = wxDynamicCast(theCtrl, wxTextCtrl);
        //Do something on the text control
    }
}

//do not update the manager in this case because you work only on the window
//myManager->Update();
//try thisPage->Update(); instead but probably not necessary


You should use the wxWidgets forum and the wxWiki where you will find a lot of info for beginners. Consult also the documentation (the Windows chm format is also really nice) and of course the sources directly :)

Regards
R.U.10
Registered User
 
Posts: 30
Joined: Mon May 21, 2007 9:26 am

Return to wxAUI Questions, Thoughts & Feedback