[Lazarus] How do you remove form caption area?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] How do you remove form caption area?

Anthony Walter
I want to a design form with controls on it but without a caption area, much like to window:


How is this possible with the LCL?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How do you remove form caption area?

leledumbo
Administrator
BorderStyle := bsNone
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How do you remove form caption area?

Anthony Walter
BorderStyle := bsNone

And that removes the border. See the original linked screenshot.



On Sat, Oct 5, 2013 at 12:09 AM, leledumbo <[hidden email]> wrote:
BorderStyle := bsNone



--
View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-How-do-you-remove-form-caption-area-tp4033716p4033717.html
Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com.

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How do you remove form caption area?

leledumbo
Administrator
No idea then, seems to be Windows API specific
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How do you remove form caption area?

silvioprog
uses
  unit2;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2 := TForm2.Create(Self);
  Form2.ShowModal;
  Form2.Free;
end;

---

uses
  Windows;

procedure TForm2.FormShow(Sender: TObject);
begin
  SetWindowLong(Handle, GWL_STYLE,
    GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION));
  SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0,
    SWP_DRAWFRAME or SWP_NOMOVE or SWP_NOSIZE);
end;

--
Silvio Clécio
My public projects - github.com/silvioprog

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How do you remove form caption area?

silvioprog
2013/10/5 silvioprog <[hidden email]>
uses
  unit2;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2 := TForm2.Create(Self);
  Form2.ShowModal;
  Form2.Free;
end;

---

uses
  Windows;

procedure TForm2.FormShow(Sender: TObject);
begin
  SetWindowLong(Handle, GWL_STYLE,
    GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION));
  SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0,
    SWP_DRAWFRAME or SWP_NOMOVE or SWP_NOSIZE);
end;

In mainform:

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Windows, Forms;

type

  { TForm1 }

  TForm1 = class(TForm)
    procedure FormShow(Sender: TObject);
  private
    procedure WMNCHitTest(var Msg: TMessage); message WM_NCHITTEST;
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

procedure TForm1.FormShow(Sender: TObject);
begin
  SetWindowLong(Handle, GWL_STYLE, WS_OVERLAPPEDWINDOW and (not WS_CAPTION));
  SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_DRAWFRAME or
    SWP_NOMOVE or SWP_NOSIZE);
end;

procedure TForm1.WMNCHitTest(var Msg: TMessage);
begin
  inherited;
  case Msg.Result of
    HTTOP: Msg.Result := HTCLIENT;
    HTTOPLEFT: Msg.Result := HTCLIENT;
    HTTOPRIGHT: Msg.Result := HTCLIENT;
    HTBOTTOM: Msg.Result := HTCLIENT;
    HTBOTTOMLEFT: Msg.Result := HTCLIENT;
    HTBOTTOMRIGHT: Msg.Result := HTCLIENT;
    HTLEFT: Msg.Result := HTCLIENT;
    HTRIGHT: Msg.Result := HTCLIENT;
  end;
end;

end.

--
Silvio Clécio
My public projects - github.com/silvioprog

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How do you remove form caption area?

Graeme Geldenhuys-2
In reply to this post by silvioprog
On 2013-10-05 15:32, silvioprog wrote:
> procedure TForm2.FormShow(Sender: TObject);
> begin
>   SetWindowLong(Handle, GWL_STYLE,
>     GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION));
>   SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0,
>     SWP_DRAWFRAME or SWP_NOMOVE or SWP_NOSIZE);
> end;


Does LCL not have a TPopupWindow class? eg: like you would use for Hint
Windows, Splash Screens etc? Weird.


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How do you remove form caption area?

Howard Page-Clark
On 05/10/2013 16:25, Graeme Geldenhuys wrote:

> Does LCL not have a TPopupWindow class? eg: like you would use for Hint
> Windows, Splash Screens etc? Weird.

There is THintWindow in the Forms unit, but AFAIK it does not allow the
kind of border the OP wants without resorting to calls such as
SetWindowPos of which silvio gave an example.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] How do you remove form caption area?

Zaher Dirkey
In reply to this post by silvioprog
In Delphi we set Caption to '' and BorderIcons = [] but that not work in Lazarus


On Sat, Oct 5, 2013 at 5:32 PM, silvioprog <[hidden email]> wrote:
uses
  unit2;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2 := TForm2.Create(Self);
  Form2.ShowModal;
  Form2.Free;
end;

---

uses
  Windows;

procedure TForm2.FormShow(Sender: TObject);
begin
  SetWindowLong(Handle, GWL_STYLE,
    GetWindowLong(Handle, GWL_STYLE) and (not WS_CAPTION));
  SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0,
    SWP_DRAWFRAME or SWP_NOMOVE or SWP_NOSIZE);
end;

--
Silvio Clécio
My public projects - github.com/silvioprog

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




--
I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Best Regards
Zaher Dirkey

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus