Recent

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

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: Windows without titlebar but with icons
« Reply #15 on: May 26, 2017, 12:28:06 pm »
It´s unable to find back.png so i created a simple image file with this name.

Or change/point the back.png to any of your image file. The author forgot to include it in the zip files, or maybe the size is too big so it is removed.

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: Windows without titlebar but with icons
« Reply #16 on: May 26, 2017, 07:20:50 pm »
@Handoko: ...must be the weather !!! :P

Did you check if the program really executes the code "Application.Minimize" ?
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

sky_khan

  • Guest
Re: Windows without titlebar but with icons
« Reply #17 on: May 26, 2017, 07:27:03 pm »
It works on win32 widgetset but fails on Gtk2. I checked on a linux VM with gtk2 widgetset. Minimize or maximize does not work when form has no border and border icons. So my code is not so cross-platform but unfortunately my experience is mostly windows specific . I dont really know if it can be done with gtk2.

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: Windows without titlebar but with icons
« Reply #18 on: May 26, 2017, 07:36:40 pm »
Maximize works on my Linux GTK 2. For the minimize feature I use TForm.Hide, which works like minimize.

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: Windows without titlebar but with icons
« Reply #19 on: May 26, 2017, 08:44:18 pm »
If you also want to move the Window it's slightly more complicated:
BTW: You could use the patch of LMDI to see something like that, you only need to exchange the bitmaps...
https://bugs.freepascal.org/view.php?id=31924
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: Windows without titlebar but with icons
« Reply #20 on: May 27, 2017, 06:02:10 pm »
Resizing can be done like this:

For example (of course there are several ways...):
Code: Pascal  [Select][+][-]
  1. Procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState;
  2.                                X, Y  : Integer);
  3.   Var
  4.    rCheckMouse  : TRect;
  5.    booChangedCur: Boolean;
  6.  Begin
  7.   booChangedCur:= False;
  8.  
  9.   // BORDER TOP
  10.   rCheckMouse:= Rect(iEdgeSize, 0, Width-iEdgeSize, iBorderWidth);
  11.    If PtInRect(rCheckMouse, Point(X,Y))
  12.    Then
  13.     Begin
  14.      booChangedCur:= True;
  15.      Cursor       := crSizeNS;
  16.       If ssLeft In Shift
  17.       Then
  18.        Begin
  19.         ReleaseCapture;
  20.         SendMessage(Handle, LM_SysCommand, $F003, 0);
  21.        End;
  22.     End;
  23.  
  24.   // BORDER RIGHT
  25.   rCheckMouse:= Rect(Width-iBorderWidth, iEdgeSize, Width, Height-iEdgeSize);
  26.    If PtInRect(rCheckMouse, Point(X,Y))
  27.    Then
  28.     Begin
  29.      booChangedCur:= True;
  30.      Cursor       := crSizeWE;
  31.       If ssLeft In Shift
  32.       Then
  33.        Begin
  34.         ReleaseCapture;
  35.         SendMessage(Handle, LM_SysCommand, $F002, 0);
  36.        End;
  37.     End;
  38.  
  39.   // BORDER BOTTOM
  40.   rCheckMouse:= Rect(iEdgeSize, Height-iBorderWidth, Width-iEdgeSize, Height);
  41.    If PtInRect(rCheckMouse, Point(X,Y))
  42.    Then
  43.     Begin
  44.      booChangedCur:= True;
  45.      Cursor       := crSizeNS;
  46.       If ssLeft In Shift
  47.       Then
  48.        Begin
  49.         ReleaseCapture;
  50.         SendMessage(Handle, LM_SysCommand, $F006, 0);
  51.        End;
  52.     End;
  53.  
  54.   // BORDER LEFT
  55.   rCheckMouse:= Rect(0, iEdgeSize, iBorderWidth, Height-iEdgeSize);
  56.    If PtInRect(rCheckMouse, Point(X,Y))
  57.    Then
  58.     Begin
  59.      booChangedCur:= True;
  60.      Cursor       := crSizeWE;
  61.       If ssLeft In Shift
  62.       Then
  63.        Begin
  64.         ReleaseCapture;
  65.         SendMessage(Handle, LM_SysCommand, $F001, 0);
  66.        End;
  67.     End;
  68.  
  69.   // EDGE UPPER LEFT
  70.   rCheckMouse:= Rect(0, 0, iEdgeSize, iEdgeSize);
  71.    If PtInRect(rCheckMouse, Point(X,Y))
  72.    Then
  73.     Begin
  74.      booChangedCur:= True;
  75.      Cursor       := crSizeNWSE;
  76.       If ssLeft In Shift
  77.       Then
  78.        Begin
  79.         ReleaseCapture;
  80.         SendMessage(Handle, LM_SysCommand, $F004, 0);
  81.        End;
  82.     End;
  83.  
  84.   // EDGE UPPER RIGHT
  85.   rCheckMouse:= Rect(Width - iEdgeSize, 0, Width, iEdgeSize);
  86.    If PtInRect(rCheckMouse, Point(X,Y))
  87.    Then
  88.     Begin
  89.      booChangedCur:= True;
  90.      Cursor       := crSizeNESW;
  91.       If ssLeft In Shift
  92.       Then
  93.        Begin
  94.         ReleaseCapture;
  95.         SendMessage(Handle, LM_SysCommand, $F005, 0);
  96.        End;
  97.     End;
  98.  
  99.   // EDGE BOTTOM RIGHT
  100.   rCheckMouse:= Rect(Width-iEdgeSize, Height-iEdgeSize, Width, Height);
  101.    If PtInRect(rCheckMouse, Point(X,Y))
  102.    Then
  103.     Begin
  104.      booChangedCur:= True;
  105.      Cursor       := crSizeNWSE;
  106.       If ssLeft In Shift
  107.       Then
  108.        Begin
  109.         ReleaseCapture;
  110.         SendMessage(Handle, LM_SysCommand, $F008, 0);
  111.        End;
  112.     End;
  113.  
  114.   // EDGE BOTTOM LEFT
  115.   rCheckMouse:= Rect(0, Height-iEdgeSize, iEdgeSize, Height);
  116.    If PtInRect(rCheckMouse, Point(X,Y))
  117.    Then
  118.     Begin
  119.      booChangedCur:= True;
  120.      Cursor       := crSizeNESW;
  121.       If ssLeft In Shift
  122.       Then
  123.        Begin
  124.         ReleaseCapture;
  125.         SendMessage(Handle, LM_SysCommand, $F007, 0);
  126.        End;
  127.     End;
  128.  
  129.   // NORMAL CURSOR
  130.   If Not booChangedCur
  131.   Then Cursor:= crDefault;
  132.  End;
  133.  
  134.  
  135. Procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
  136.                              Shift : TShiftState; X, Y: Integer);
  137.  Begin
  138.   If Button = mbRight
  139.   Then Close;
  140.  End;
  141.  
  142.  
  143. Procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  144.                                Shift : TShiftState; X, Y: Integer);
  145.   Var
  146.    rMoveWnd     : TRect;
  147.    booChangedCur: Boolean;
  148.  Begin
  149.   booChangedCur:= False;
  150.   rMoveWnd:= Rect(iEdgeSize, iBorderWidth, Width-iEdgeSize, 30);
  151.  
  152.    If PtInRect(rMoveWnd, Point(X, Y))
  153.    Then
  154.     Begin
  155.      booChangedCur:= True;
  156.      Cursor       := crSize;
  157.       If ssLeft In Shift
  158.       Then
  159.        Begin
  160.         ReleaseCapture;
  161.         SendMessage(Handle, LM_SysCommand, $F012, 0);
  162.        End;
  163.     End;
  164.  
  165.   If Not booChangedCur
  166.   Then Cursor:= crDefault;
  167.  End;          
  168.  

Is this working on a MAC and under LINUX too ??? And what about Win10 ???
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

 

TinyPortal © 2005-2018