Recent

Author Topic: Simple form with custom title bar example program.  (Read 1125 times)

GypsyPrince

  • New Member
  • *
  • Posts: 40
Simple form with custom title bar example program.
« on: May 22, 2025, 04:35:06 pm »
Has anyone considered making a simple/small 'form with custom title bar' example program?

I am a mechanical engineer by profession rather than a programmer, but I do create some small utility programs for myself that I sometimes share with co-workers.
I often simulate the Symantec Norton Utilities for MS-DOS user interface because: a. I love that interface  b. My co-workers L-O-V-E it.  c. It is simple, pleasing to the eye, and is not too "busy" or mentally distracting like most modern GUIs.

Anyway, simulating this GUI is easy in some other programming environments, but I haven't yet conquered doing it in Lazarus.  Could someone please create a very simple example program which uses a custom titlebar and includes all the functionality of the regular windows titlebar (Minimize, Maximize, Restore, move/drag with mouse, caption, etc.).  The form's extended functionality would only need be something as simple as a single button that displays a message box saying "Hello world!" when clicked.  I'm guessing others might also have a need for such an example program - if only for tinkering and experimenting with it.

I can then use those code examples to work out how I will make my Norton's Utilities simulated GUI (see attached image) work.  All other Norton GUI features - apart from the titlebar and all of its (the titlebar's) functionality - I can already successfully simulate using existing LCL components.
« Last Edit: May 22, 2025, 05:21:51 pm by GypsyPrince »

paweld

  • Hero Member
  • *****
  • Posts: 1420
Best regards / Pozdrawiam
paweld

GypsyPrince

  • New Member
  • *
  • Posts: 40
Re: Simple form with custom title bar example program.
« Reply #2 on: May 23, 2025, 03:25:25 pm »
@paweld

FreeVision doesn't meet my needs...

     I am wanting a very small/simple example of a form program that looks just like a regular form window but where the titlebar is custom drawn.  I want the form and titlebar to look and behave exactly like the default (template) form and titlebar (including mouse dragging and border resizing) but it is implemented using a TPanel and other LCL controls and it is coded by hand - similar to the image attached to this response.  Because this would require setting the form's BorderStyle property to "bsNone" the borders and their resizing functionality would need to be manually coded to replace it.

     My goal is for users (myself included) to be able to learn how the titlebar and behaviors are implemented so that we can then adapt the coded examples to create our own customized titlebars and forms.    The cosmetic appearance of default form windows rarely keeps up with the latest trends of GUIs.  If we can learn the basic behaviors of the forms (mostly the borders and titlebars) we can create our own forms that look anyway we want without having to resort to a new technology or third-party controls. 

     For example: when I learned how Visual Basic .NET draws and implements its titlebars, system menu, minimize and maximize buttons, etc., as well as how to code the resizing of the form borders, I was then able to give my forms any visual appearance I want using only the default WinForms platforms and without having to resort to the WPF or WinUI platforms. I can simulate any user interface anyone else creates in VB using either of those platforms while by sticking with only the WinForms platform.

     This is the ENTIRE purpose of this thread - for users to learn the coding basics of how the basic form's borders are drawn and resized, how the titlebar and its system menu are created and implemented as well as the Min/Max/Close buttons, how the form is dragged by grabbing the titlebar, etc., so that we can then expand on what we learn to give our user interface any cosmetic appearance we want in Lazarus. Then, I can make my apps simulate the Norton Utilities GUI shown in the original post without having to resort to a separate platform like FreeVision.  In fact, if this example is done well, it could be made into a template form for Lazarus in future releases.

     This previous thread I found comes close to what I am looking for (but not quite): https://forum.lazarus.freepascal.org/index.php/topic,33899.0.html
Maybe I can tinker with it long enough to create the simple example program, but I'd rather someone with far more experience in FreePascal/Lazarus do it so that we know we will be learning from correctly implemented code rather than my amateur code.
« Last Edit: May 23, 2025, 03:28:26 pm by GypsyPrince »

paweld

  • Hero Member
  • *****
  • Posts: 1420
Re: Simple form with custom title bar example program.
« Reply #3 on: May 23, 2025, 03:58:33 pm »
I didn't understand exactly what you meant, especially in the context of the description and screenshots of the TUI app.

Check this: https://forum.lazarus.freepascal.org/index.php/topic,68399.msg528936.html#msg528936
Best regards / Pozdrawiam
paweld

GypsyPrince

  • New Member
  • *
  • Posts: 40
Re: Simple form with custom title bar example program.
« Reply #4 on: May 23, 2025, 05:51:47 pm »
@paweld

     Thank you for this!  And I deeply apologize for not being able to make my wishes more clear in the original post.  Normally, this would be exactly what I need, except... this project uses yet another library (BGRABitmap/BGRAControls) which I cannot get to work - no matter what I do.

     This sample program uses a control named TBCButton from within the BGRAControls library.  When I first loaded the project into Lazarus, it said these packages were not installed and tried to download them.  Whether the listed link in the package manager is faulty or not I don't know but after a couple of minutes I got a timed out error saying the packages couldn't be downloaded.  So, I manually downloaded them from GitHub and after 30 minutes and fighting with those, I finally got the packages installed.  However, I still get an error message saying the TBCButton class is not registered.

     This very annoyance being caused by dependencies on additional libraries is EXACTLY what I am trying to avoid by going the route that I am.  If the library does not come stock with the original programming language or environment (Lazarus) and is produced by anyone other than those who create the original environment or myself then I want absolutely no part of it because other people's mistakes tend to become my nightmare to have to work out. LOL

     Thank you very much, anyway!  I greatly appreciate your effort.

paweld

  • Hero Member
  • *****
  • Posts: 1420
Re: Simple form with custom title bar example program.
« Reply #5 on: May 23, 2025, 06:49:09 pm »
@paweld

     Thank you for this!  And I deeply apologize for not being able to make my wishes more clear in the original post.
Nothing happened. My English is not very good, so there's a good chance I might have misunderstood.
Quote
Normally, this would be exactly what I need, except... this project uses yet another library (BGRABitmap/BGRAControls) which I cannot get to work - no matter what I do.
Attached is a version with the BGRAControls dependency removed (it does not have a "hamburger menu"). It should work, but I was doing the editing on my phone, so if there's a problem, I'll try to help when I'm at my computer (in about 12h)
Best regards / Pozdrawiam
paweld

GypsyPrince

  • New Member
  • *
  • Posts: 40
Re: Simple form with custom title bar example program.
« Reply #6 on: May 23, 2025, 06:57:59 pm »
@paweld

It worked!!!

Thank you, again!  You are A-W-E-S-O-M-E-!-!

 

TinyPortal © 2005-2018