(Un)Docking in Delphi 4 - 2 questions


I am a Delphi-amateur and I have two questions about undocking of a
component in Delphi 4.

1. In a certain program on which I am working I have several Toolbars docked
in one Controlbar. If I run the program, the first time I undock a toolbar,
the OnUndock-event of the Controlbar is not called; only the second, third
etc. time. To investigate this strange phenomenon I placed a button on the
form with an OnClick event handler as follows:

procedure TGrammForm.Button1Click(Sender: TObject);
  with ControlBar do for I:=0 to DockClientCount-1 do

If I press that button directly after having started the program, no
dockclients are mentioned in the ShowMessage! A toolbar-name is only
mentioned if I undock it, dock it again and press the button. (The same
holds if I have a toollbar docked in a Panel). Why are the toolbars no
DockClients at the beginning of the program? How can I let them
be it? How to get around this Delphi-bug (if it is one)?

2. If I undock a toolbar from the control bar, I want to be it a floating
toolwindow, dragged by the mouse, at the moment the cursor leaves the
control bar, just as Delphi does it with its toolbars. How to do that?

Any help will be appreciated,

Hugo Kuiper