When you create a pageframe programmatically, it may or may not have pages already on it. You can check the PageCount property. If PageCount is greater than 0 then you need to eliminate the Page1 and Page2... and start fresh. Your program then goes through the cursor containing your custom pages adding them in the order you defined them
e.g.
PageName, PageObject, PageOrder, PageCaption
pgName, cpgfName, 10, "Names"
pgAddress, cpgfAddress, 20, "Address"
pgIDs, cpgfGeneric, 30, "IDs"
pgDetails, cpgfGeneric, 40, "Details"
pgOther, cpgfGenericChild, 50, "Other"
Names Address IDs Details Other
I use a custom object called "PageFrame Director" (cpgfDirector) in order to control the Add, Change, Delete and Save of each page.
cPgf = Base
cPgfDirector = Controls which Add... on which page to execute when the add button is pressed.
cPgfFormSpecific = the specific PageFrame which has the INIT intelligence to pull the pages from the table and create them.
Add, Change, Edit, Delete, Sort... can either be methods of the Page or a container on a page. This would depend on how you program the PageFrame Director. Considering the dynamic nature of save, I placed my Saves in containers.
Too much information I know...