* * *

Author Topic: Windows without titlebar but with icons  (Read 530 times)

Pascal

  • Sr. Member
  • ****
  • Posts: 348
Windows without titlebar but with icons
« on: May 10, 2017, 08:41:47 pm »
How can i accomplish this:
A window without titlebar but with minimize, maximize and close buttons.

laz trunk - fpc trunk 32bit - Windows 10 Pro x64

taazz

  • Hero Member
  • *****
  • Posts: 3744
Re: Windows without titlebar but with icons
« Reply #1 on: May 10, 2017, 09:01:09 pm »
you add the buttons manually
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

PatBayford

  • New member
  • *
  • Posts: 17
Re: Windows without titlebar but with icons
« Reply #2 on: May 24, 2017, 10:57:15 pm »
Not sure even placing them manually will work - I believe the Windows API will insist on adding a Title Bar if you put the system icons on the window. I assume that the later APIs behave like 95/98/XP. :-(

rvk

  • Hero Member
  • *****
  • Posts: 2416
Re: Windows without titlebar but with icons
« Reply #3 on: May 24, 2017, 11:33:58 pm »
It isn't possible in a "normal" Windows application.

My guess is that the image from the opening post is from a Metro (oeps) UWP Windows App. With those apps it is possible to do more with the title-bar space.

RAW

  • Full Member
  • ***
  • Posts: 193
Re: Windows without titlebar but with icons
« Reply #4 on: May 24, 2017, 11:39:35 pm »
What's the problem?
Take 3 PNG's (TImage) and place them in the upper right corner (bsNone-Window)... done  :P
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 1.6.4 FPC 3.0.2

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5338
Re: Windows without titlebar but with icons
« Reply #5 on: May 24, 2017, 11:44:13 pm »
All three buttons are visible in the far right corner.

So it seems what you are watching is  a very large window that is partially transparent with an extra hand drawn close button in the visible area.

rvk

  • Hero Member
  • *****
  • Posts: 2416
Re: Windows without titlebar but with icons
« Reply #6 on: Today at 12:09:36 am »
All three buttons are visible in the far right corner.

So it seems what you are watching is  a very large window that is partially transparent with an extra hand drawn close button in the visible area.
No, those are not hand drawn buttons. Those are the standard buttons.
(also look for SpotBright, which is in that image, you'll see it's a UWP app from Microsoft)

With a metro-app (Universal Windows Platform application) you can request to extend your form to include the titlebar area. Search for ExtendViewIntoTitleBar.

Also see https://www.eternalcoding.com/?p=1952

Unfortunately this is not possible with a standard Windows application so you would need to disable the titlebar and do all that work yourself (including double click on the titlebar area for maximize etc).
« Last Edit: Today at 12:11:29 am by rvk »

SkyKhan

  • Full Member
  • ***
  • Posts: 144
Re: Windows without titlebar but with icons
« Reply #7 on: Today at 01:40:21 am »
This is how you can imitate it. See attachment.
I will always ignore you! Yes, you too ( except if you are topic owner )

RAW

  • Full Member
  • ***
  • Posts: 193
Re: Windows without titlebar but with icons
« Reply #8 on: Today at 06:43:08 am »
@SkyKhan: Nice idea...  :)

I added nice buttons and a nice and easy click-effect...
Code: Pascal  [Select]
  1. Procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  2.                                Shift : TShiftState; X, Y: Integer);
  3.  Begin
  4.   If Sender = ImgMin
  5.   Then
  6.    If Button = mbLeft
  7.    Then
  8.     Begin
  9.      ImgMinSh.Hide;
  10.      ImgMin.SetBounds(ImgMin.Left+2, ImgMin.Top+2, Width, Height);
  11.       Update;
  12.       Sleep(70);
  13.      ImgMin.SetBounds(ImgMin.Left-2, ImgMin.Top-2, Width, Height);
  14.      ImgMinSh.Show;
  15.       Update;
  16.       Sleep(70);
  17.      Application.Minimize;
  18.     End;
  19.  
  20.   If Sender = ImgMax
  21.   Then
  22.    If Button = mbLeft
  23.    Then
  24.     Begin
  25.      ImgMaxSh.Hide;
  26.      ImgMax.SetBounds(ImgMax.Left+2, ImgMax.Top+2, Width, Height);
  27.       Update;
  28.       Sleep(70);
  29.      ImgMax.SetBounds(ImgMax.Left-2, ImgMax.Top-2, Width, Height);
  30.      ImgMaxSh.Show;
  31.       Update;
  32.       Sleep(70);
  33.  
  34.      ToggleState(0);
  35.     End;
  36.  
  37.   If Sender = ImgClose
  38.   Then
  39.    If Button = mbLeft
  40.    Then
  41.     Begin
  42.      ImgCloseSh.Hide;
  43.      ImgClose.SetBounds(ImgClose.Left+2, ImgClose.Top+2, Width, Height);
  44.       Update;
  45.       Sleep(70);
  46.      ImgClose.SetBounds(ImgClose.Left-2, ImgClose.Top-2, Width, Height);
  47.      ImgCloseSh.Show;
  48.       Update;
  49.       Sleep(70);
  50.  
  51.      Close;
  52.     End;
  53.  End;
  54.  
  55.  
  56. Procedure TForm1.ShpTitleMouseDown(Sender: TObject; Button: TMouseButton;
  57.                                    Shift : TShiftState; X, Y: Integer);
  58.  Begin
  59.   If WindowState <> WsMaximized
  60.   Then
  61.    Begin
  62.     FDragStartPoint:= Point(Mouse.CursorPos.x-Left, Mouse.CursorPos.y-Top);
  63.     Mouse.Capture  := Handle;
  64.     FDragging      := True;
  65.    End;
  66.  
  67.   If ssDouble In Shift
  68.   Then
  69.    Begin
  70.     FDragging:= False;
  71.     Application.QueueAsyncCall(@ToggleState, 0);
  72.    End;
  73.  End;
  74.  
  75.  
  76. Procedure TForm1.ShpTitleMouseMove(Sender: TObject; Shift: TShiftState;
  77.                                    X, Y  : Integer);
  78.  Begin
  79.   If FDragging
  80.   Then
  81.    Begin
  82.     Left:= Mouse.CursorPos.x-FDragStartPoint.x;
  83.     Top := Mouse.CursorPos.y-FDragStartPoint.y;
  84.    End;
  85.  End;
  86.  
  87.  
  88. Procedure TForm1.ShpTitleMouseUp(Sender: TObject; Button: TMouseButton;
  89.                                  Shift : TShiftState; X, Y: Integer);
  90.  Begin
  91.   Mouse.Capture:= 0;
  92.   FDragging    := False;
  93.  End;              
  94.  
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 1.6.4 FPC 3.0.2

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus