If a panel is made part of a tab (InsertPanelAsTabPage) or if a panel handle is obtained from a tab (GetPanelHandleFromTabPage), there are some restrictions as to how you can use that panel. Some of those restrictions could be lifted if the panel knew which tab it belonged to.
I suggest the addition of the following (or similar) attributes:
GetPanelAttribute(Panel, ATTR_PANEL_PARENT_TAB_CTRL, &TabCtrl);
GetPanelAttribute(Panel, ATTR_PANEL_PARENT_TAB_INDEX, &TabIndex);
And of course you can already get the parent panel with:
GetPanelAttribute(Panel, ATTR_PANEL_PARENT, &ParentTab);
So, now that a panel knows the tab it belongs to, some obvious associations can be handled by the UIR library:
- Calling DiscardPanel should, internally, call DeleteTabPage instead of the current undefined and illogical behavior
- SetActivePanel should do a SetActiveTabPage instead of the current buggy behavior
- SetPanelAttribute(.., ATTR_DIMMED) should do a SetTabPageAttribute(..., ATTR_DIMMED)
- - etc...
This would allow the user to select at runtime if he wants a Multiple Panels application (MDI) or a Single Panel/Multiple Tab application (tabbed SDI) and almost no changes are necessary to the code.