07-07-2013 04:01 AM
Hi, how do we create a Page in a separate c++ class?
I have an AppName.CPP that has a NavigationPane and I would like to create a Page in a separate CPP file, and later initialize this Page from my AppName.CPP.
Any thoughts on how to do this?
07-07-2013 01:10 PM
In your separate CPP file create your page, and have a "getPage()" method that you return a pointer to this Page.
AppName.cpp will now use this getPage() method to get a reference to the page and set it to the application scene, as well as modify it any way it needs to.
However, be careful with the ownership models here. Read up here:
If the Page doesn't already have a parent the Application will attempt to take ownership of the page. If that page is ever popped off the stack, your separate CPP file might be pointing to garbage memory and start causing crashes!