Whole layout structure is encoded inside ZoneTree, which is exposed via Site.RootZone property. Each DockPanel also provides acees to its own zone via Panel.Zone property.
To achieve what you want, Panel's parent zone, which can be acessed via Panel.Zone.Parent can be used. This zone sohuld be ofzkTabs kind, since the panel is a tabbed document. So, its SelectedPage property can be set to any of its child zones to activate another panel.
What you mean saying "empty"? nil? If yes, then its strange.
dp.Zone cannot be nil, because your panel is docked and will stay docked (even when invisible) until it destroyed. dp.Zone.Parent can be nil, in some cases (if panel is not a tabbed document, for example).
Changing Index property (SelectedPage.Index := i -1;) is not correct. You move some zone to another location, but this does not change SelectedPage itself.
You need to do something like this:
dp := Parent as TLMDDockPanel;
dz := dp.zone; // Panel's zone.
i := dz.Index;
tz := dz.Parent; // Tabs zone.
if (tz <> nil) and (i > 0) then // If we are inside tabs and
// we are not the first child.
begin
prevz := tz[i - 1]; // Previous zone.
tz.SelectedPage := prevz; // Change selected tab to prev zone.
Comments