Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Move / Drag a TForm
Sun, May 8 2016 2:33 AMPermanent Link

Eivind

All

I have a new requirement to put some menu buttons on the caption bar of a form. Up until now I have only been using TDialogs. As it's not possible to drop components on the caption bar I was thinking about using a TForm instead and use a THeaderPanel as the caption bar. That all work fine, but now I'm unable to move the form around that is also required.

Does anyone know how I can drag / move a TForm by clicking and dragging the HeaderPanel?

Thanks for any input

Br
Eivind
Sun, May 8 2016 5:00 PMPermanent Link

Trinione

<< Does anyone know how I can drag / move a TForm by clicking and dragging the HeaderPanel? >>

Eivind:
I know this is not what you are after. But, it may work for you in the interim.

 Panel1.CaptionBar.AllowMove := True;
 Panel1.CaptionBar.Height := 20;
 Panel1.CaptionBar.Caption := #10538 + #10536;
Sun, May 8 2016 9:04 PMPermanent Link

Rick

On 08/05/16 16:33, Eivind wrote:
> I have a new requirement to put some menu buttons on the caption bar of a form. Up until now I have only been using TDialogs. As it's not possible to drop components on the caption bar I was thinking about using a TForm instead and use a THeaderPanel as the caption bar. That all work fine, but now I'm unable to move the form around that is also required.
>
> Does anyone know how I can drag / move a TForm by clicking and dragging the HeaderPanel?
>

You can add controls to the caption bar of a TDialog via code. Just drop
the controls onto the TDialog in the IDE and then relocate them in the
OnCreate event.

For example, drop a TButton on to the TDialog client area and add the
following:

procedure TForm1.Form1Create(Sender: TObject);
begin
  Button1.Parent:=CaptionBar;
  Button1.Top:=0;
  Button1.Left:=300;
end;

If you really want to mouse move a standard TForm via a child component
(e.g. header panel) then you may be able to use the provided DoCapture
functionality. Have a look at the following post:

http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb2_preview&msg=962&page=1

--
Rick
Image