Главная страница | назад





Article #19285: How to prevent closing of an undocked ToolBar

 Question and Answer Database
FAQ4285D.txt :How to prevent closing of an undocked ToolBar
Category :Miscellaneous
Platform :Win95/NT
Product :Delphi4.x,
Question:
How do I prevent a user from closing (hiding) an undocked ToolBar?
Answer:
Here's one possible solution. You have to create your own TToolDockForm descendant, and in it you want to
make sure that the border icon is gone as well as preventing Alt+F4.
type
TMyToolDockForm = class(TToolDockForm)
constructor Create(AOwner: TComponent); override;
procedure DoClose(var Action: TCloseAction); override;
end;
constructor TMyToolDockForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
BorderIcons := [];
end;
procedure TMyToolDockForm.DoClose(var Action: TCloseAction);
begin
Action := caNone;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
i : Integer;
begin
for i:=0 to ComponentCount-1 do
if Components[i] is TToolBar then
TToolBar(Components[i]).FloatingDockSiteClass := TMyToolDockForm;
end;
3/10/99 10:38:05 AM

Last Modified: 01-SEP-99