It looks like you're new here. If you want to get involved, click one of these buttons!
I am having a problem with hiding showing and hiding Tool panels.
I create user documents as tabbed docs at run time. There are 2 different document types, an editor and a viewer.
When the viewer is in focus, I want a specific Tool panel to appear and that tool panel to hide when the user selects a different editor tab.
My code hides the viewer's tool panel when it closes and un-hides it when it is opened and this works fine. However if I choose an editor tab without closing the Viewer tab, the Viewer tool panel remains. When I return to the Viewer Tab the Viewer tool panel is then hidden.
In debug stepping through the code it works as expected, its only when I run it direct that things get out of order which indicates to me that there is a race issue somewhere.
Below is the code I am using on entering, leaving and Closing the page.
procedure tfmPDFPage.DocEnter(Sender: TObject); // Code called on entering the Viewer Tab.
fmIDEMain.ActivePDF := Self;
if PageID <> fmPdfExplorer.ActivePDFID then begin
gtPDFViewer1.Active := false;
fmPDFExplorer.gtPDFOutlineViewer1.Active := true; // The viewers Tool panel
gtPDFViewer1.Active := true;
fmPDFExplorer.ActivePDFID := PageID;
// Show the PDF Explorer
fmIDEMain.dpPDFExplorer.PanelVisible := true; // Here we make the Viewer Tool panel visible
procedure TfmPDFPage.DocExit(Sender: TObject); // Code is called on leaving the viewer tab.
fmPDFExplorer.gtPDFOutlineViewer1.Active := false;
fmIDEMain.dpPDFExplorer.PanelVisible := false;
procedure tfmPDFPage.DocClose(Sender: TObject; // Code called on closing the Viewer Tab.
Var Action: TLMDockPanelCloseAction);
Var dz,tz, prevz: TLMDDockZone;
fmIDEMain.ActivePDF := nil; //Select the previous tab
if Assigned(ActivePanel) then begin
dp := ActivePanel;
dz := dp.zone;
if Assigned(dz) then begin
i := dz.Index;
tz := dz.parent;
if Assigned(tz) and (i > 0) then begin
prevz := tz[i - 1];
tz.SelectedPage := prevz;
ActivePanel := tz.SelectedPage.Panel;
else ActivePanel := nil;
Action := caFree;