This forum is temporaily read-only. All existing discussions remain available for reference. For new questions, bug reports or support requests, please contact us at mail@lmdsupport.com.
How to ensure objects in a Tabbed Dock panel have closed before opening the next doc TabbedPanel.
I am using Tabbed docs to hold a number of editor pages. When I close the a tab I want the document to close and the next lower tab to be selected. By default, after closing a tab the selected first tab is selected which is not necessarily the one adjacent to the tab being closed. I use a routine which selects the previous tab based on a routine you suggested in an earlier query. This is the procedure.
procedure TfmIDEMain.SelectPrevTab;
Var dz,tz, prevz: TLMDDockZone;
dp: TLMDDockPanel;
i: Integer;
begin
if Assigned(ActivePanel) then begin
Application.ProcessMessages; // Give time for last ppage to close
dp := ActivePanel;
ActivePanel := nil;
dz := dp.zone;
if Assigned(dz) then begin
i := dz.Index;
tz := dz.parent;
if Assigned(tz) and (i > 1) then begin
prevz := tz[i - 1];
tz.SelectedPage := prevz;
if Assigned(tz)
and (tz.SelectedPage.Panel.ClientKind = dkDocument) then begin
ActivePanel := tz.SelectedPage.Panel;
case TIDEPageType(ActivePanel.tag) of
ptEditor: TfmEditor(ActivePanel.Controls[0]).DocEnter(self);
ptPDF: TfmPDFPage(ActivePanel.Controls[0]).DocEnter(self);
end;
end;
end;
end;
end;
end;
The problem I have is that if I call this routine from my DocClose event it activates the previous panel before has been able to close. By removing the highlighted DocEnter from the SelectPrevTab routine I can set the new active panel before the document has closed. How can I call the appropriate DocEnter after the document is closed? The only way I can think of doing it is to fire a timer off on the main form which allows sufficient time for the closing document to complete the closure before calling ActivePanel.DocEnter Is there a better way?

Comments