Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

Docking Question


I am writing an app and I would like to implement docking.  I have two questions I would like to ask.  I'll give 50 points for each question with a grade of A.

1. How do I prevent floating windows (which are undocked) from being closed?  IE.  If you undock a panel, it gives you a ToolWindow style window with a close control.  I'll like to make it impossible for this ToolWindow to close.

2. How to you automatically show the docking caption bar in the application?  I'll explain.  If you have a control docked, by default you don't get the double lined caption bar above the control.  The way I force this is to first undock the control using Control.ManualDock(nil) in the FormCreate, then Control.ManualDock(DockContainer) in the FormShow.  This works well, but the docked controls flash up on the screen when they're being created.  It's not neat.

Delphi manages this well with the Messages ListBox which docked at the bottom of the editor.

Thanks for any info.


1 Solution

this should deal with the first part of your question:
a small example, Delete the messagebox code if you wish and just use the Canclose:=False; command.

// hook up the FormCloseQuery event

procedure TForm1.FormCloseQuery
(Sender: TObject; var CanClose: Boolean);
if MessageDlg('Really close this window?',
 mtConfirmation, [mbOk, mbCancel], 0) = mrCancel then
 CanClose := False;

good luck
Stuart_JohnsonAuthor Commented:
Hi T,

It's not the form that closing, it's the undocked component.  Components don't have a FormCloseQuery event.

Silly me! :)
Sorry about that, I misunderstood.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Okay this might not be a solution, but you can try using the Toolbar2000 components ( Either the component itself (or one of its plugins) will be able to do what you want.
Stuart_JohnsonAuthor Commented:
Hi DS,

Thanks for that, but I'm trying to steer clear of 3rd party components.  There must be a way of doing it without using components.

I just found out that if you 'close' a ToolWindow containing the undocked controls, Delphi doesn't actually close the window, but hides it.  So, I can quite easily reshow the control if needed.

Stuart_JohnsonAuthor Commented:
I'm going to ask for this question to be deleted as there was no additional information provided.

Please post any objections.

50 points refunded, question closed.  This has been "pending deletion"; but will not complete without Moderator intervention once comments have been added.
Moondancer - EE Moderator
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now