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