We have a CPropertySheet that have 5 CPropertyPage inside.
Let say we have something like this
1 2 3 4 5
Then, based on some business logic, when the user click refresh, we would like to have
1 5 2 3 4
We don't want to delete all the CPropertyPage and recreate them in the correct order (with AddPage()
), we just want to update the position of the page in the sheet.
Is this possible?
Thanks!
Microsoft's MFC CPropertySheet doesn't have a function to do this, however, if you check the Property Sheet Windows Controls API, you can achieve something similar by removing the page you want to move and then insert it at the desired position.
To do this, you first need to subclass CPropertySheet and add a function to insert a page to a given order:
I based this fonction on the CPropertySheet::AddPage code, but at the end of the function, I substituted the message PSM_ADDPAGE to PSM_INSERTPAGE
Then, to move a page to a specific position, just remove it, then add it at the desired position.