Buttons in Title bar lazarus / 21-General ---------------------------------------------------------------------- cpalx · 2021-05-21 19:57 Hello, Does somebody know how to add buttons, and change color in title bar? i attached an image Will be great if works in windows, Linux and Mac Thanks, ---------------------------------------------------------------------- cpalx · 2021-05-21 20:19 In Delphi exists CustomTitleBar http://docwiki.embarcadero.com/RADStudio/Sydney/en/Custom_Title_Bar_fo r_VCL_Forms is there any idea how to make it in Lazarus? ---------------------------------------------------------------------- winni · 2021-05-21 21:16 Hi! The titlebar can only be reached with some Delphi-tricks in windows. With Linux the titlebar belongs to the window manager, which ist part of the Linux desktop and not the Lazarus LCL. So there is no easy solution. Let's see if I can find some dirty tricks. Winni Winni ---------------------------------------------------------------------- jamie · 2021-05-21 21:24 Don't use that hack, it will only disappoint you later on when MS changes their themes handling, plus it only works on recent windows.. If you want such control then use Tpanel at the top where you can place any control you wish in it including simulating the ICONS on the right. Set the form for borderless so there is no non - client area.. Now you are you responsible for the complete drawing and also handling of the window drags etc.. This should all be doable using LCL front end. ---------------------------------------------------------------------- cpalx · 2021-05-21 22:39 @jamie, the problem is to resize the form ---------------------------------------------------------------------- jamie · 2021-05-21 22:54 Keep a margin around the border of the form and in the form.OnPaint, draw the border so it has a nice looking edge or what ever you want then process the LM_NCHITTEST message.  By setting the proper data flags in the return of the message you can tell the window manager where the cursor is, in your case you can tell it it's in the border areas and which one so that windows will handle the move as if you had a non client area..  Look up the WM_NCHITTEST. ---------------------------------------------------------------------- cpalx · 2021-05-22 16:18 @jamie, but this WM_NCHITTEST only works on Windows ---------------------------------------------------------------------- jamie · 2021-05-22 16:36 are you sure about that, I think the LCLintf and LCL type has that in it.. also, I wasn't aware that you were not doing windows since the component you address is basically a windows target. In any case, you will find a LM_NCHITTEST in the LMessages files which indicates that it is supported..  You can use the TLMNCHitTest type in the message identifier.  if you get this support with no need of using the windows unit and simply the LCLIntf and LMessages I think you are all set. P.S.   here is a quick test run, see if that works on other targets , I think you will find it to compile. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs,lclintf,lmessages; type   { TForm1 }   TForm1 = class(TForm)  private   public    Procedure TheHitTest(Var Msg:TLMNCHitTest); Message LM_NCHITTEST;  end; var  Form1: TForm1; implementation {$R *.lfm}Procedure Tform1.TheHitTest(Var Msg:TLMNCHitTest);Begin  //Process your code here to alter the MSG record  Inherited;end; { TForm1 } end. ---------------------------------------------------------------------- Soner · 2021-05-23 09:56 Easiest way is when you create title bar self and we did this in german forum years ago. You can find my solution as aattachment. The solution from other guy is included in bgracontrols\test\test_bgra_ribbon_custom folder. My solution is simple but on windows 10 there is white area at top of the form. Some of my code is taken form this topic. Edit: Here is the topic in german forum. The solution from coast has no white area at the top of the form. As I said his code  is included in bgracontrols\test\test_bgra_ribbon_custom folder. ---------------------------------------------------------------------- jamie · 2021-05-23 10:05 Windows overlays the original window display with another window to give you the themes, there is no change to the original windows design and you can see that if you put a form inside a form, the original windows design shows there.  when doing a hit test in that section it shows the area that is another windows over laying the frame so yes, it's annoying and hard to control and can change any moment when MS thinks of another crippling feature.  So my suggesting using a borderless form which also works in the other targets to get a plain window allows you to create your own title bar if you wish and I've have done this myself in a few apps to get special title bar effects like having thumb tacks icons with special effects instead of having the default icons up there. ---------------------------------------------------------------------- winni · 2021-05-24 13:33 Hi! I made a little  demo with disabled TitleBar. The TitleBar is now made by a panel, the system icons are inside a TImage. You can select on of 6 different Icon Sets - 3 KDE and 3 Windows. If you like, you can put a button in the new TitleBar (aka Panel). Screenshot and project attached. Winni ---------------------------------------------------------------------- cpalx · 2021-07-06 14:36 The problem is resize the form ---------------------------------------------------------------------- winni · 2021-07-06 15:53 Quote from: cpalx on July 06, 2021, 04:36:06 pmThe problem is resize the form Hi ! Instead of fiddeling with the border which I hate since the appearance of the first GUI I chose another solution: 2 SpinEdits in the Titlebar for witdth and height. Screenshot and project attached. Winni ---------------------------------------------------------------------- cpalx · 2021-07-06 16:00 but it canot resize ---------------------------------------------------------------------- winni · 2021-07-06 16:27 That is the job of the two spinEdits. ---------------------------------------------------------------------- cpalx · 2021-07-06 16:32 I understand, but it is not natural. Natural is resize with the mouse ---------------------------------------------------------------------- winni · 2021-07-06 16:44 Hi! I told you I hate to hit the pedantic border space to enlarge the form. This is unnatural for me. You find things unnatural if you don't get used to things. I never got used to that way of resizing a form. So the solution with the two spinedits look mch more natural to me. But if you need it you can enhance the project with the border fiddeling. Winni ---------------------------------------------------------------------- krolikbest · 2021-07-06 17:51 Some times ago I did this little example as a proof of concept of borderless application  https://www.youtube.com/watch?v=RLMNBb2-Yjk. In the description there should be an example on my goole drive. feel free to test it. ---------------------------------------------------------------------- cpalx · 2021-07-06 18:35 thanks to answer, I tested your program, i am using Linux and does not work (QT), not move even the title bar. I tested with GTK and works moving the title bat, but not resizing. Maybe the example is not updated. Windows works perfectly ---------------------------------------------------------------------- krolikbest · 2021-07-06 19:02 I tested it in Win and Raspbian. ---------------------------------------------------------------------- cpalx · 2021-07-06 19:09 thanks @krolikbest, i will try to modify your code.