Recent

Author Topic: Custom Drawing user interface  (Read 6847 times)

axisdj

  • Jr. Member
  • **
  • Posts: 64
Custom Drawing user interface
« on: April 09, 2020, 06:34:18 pm »
Hello,

I am in the process of becoming comfortable with Lazarus, and making a goal to move from vb6.

In vb6 I was using a library called vbRichClient which wraps the Cairo drawing engine to create custom modern user interface. I use images and then draw buttons/displays on them to give the GUI a modern look

What units/classes are you guys using for custom drawing, I looked at the BGRABitmap and that looks pretty close? any other suggestions?

Thanks

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: Custom Drawing user interface
« Reply #1 on: April 09, 2020, 06:51:37 pm »
Can you post an example image to look at of a form with the controls on it?

Not sure where you are going with this but it almost sounds like a Skin interface
The only true wisdom is knowing you know nothing

axisdj

  • Jr. Member
  • **
  • Posts: 64
Re: Custom Drawing user interface
« Reply #2 on: April 09, 2020, 06:56:38 pm »
Jamie Ill send it in a private message.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Custom Drawing user interface
« Reply #3 on: April 10, 2020, 10:36:59 am »
You could take a look at this. I have not tested it, but at least it looks nice.

furious programming

  • Hero Member
  • *****
  • Posts: 852
Re: Custom Drawing user interface
« Reply #4 on: April 10, 2020, 03:02:26 pm »
There are many convenient solutions for creating components with a custom appearance, but none that allow to modify the appearance of the window border or such elements as the main menu bar. And it is a bit sad.
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Custom Drawing user interface
« Reply #5 on: April 10, 2020, 03:15:16 pm »
The border of any window is controlled by the OS, not the application. Nothing stops you from setting your borderstyle to bsNone and draw your own (though you also need to handle window movement yourself then).

Same for the menu: Lazarus relies on the operating system to handle this (e.g. on macOS the menu is located at the top and can't be drawn by the application, and I think in X11 environments that's possible to configure as well). You can always draw your own menu, though your application will look out of place on systems that have the menu bar outside of the client area and thus outside fo your application's influence.

mercurhyo

  • Full Member
  • ***
  • Posts: 242
Re: Custom Drawing user interface
« Reply #6 on: April 10, 2020, 06:03:02 pm »
there is also the forgotten TForm.shape solution, then you can even draw eggforms  8-) happy easter
« Last Edit: April 10, 2020, 06:04:52 pm by mercurhyo »
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

mercurhyo

  • Full Member
  • ***
  • Posts: 242
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

mercurhyo

  • Full Member
  • ***
  • Posts: 242
Re: Custom Drawing user interface
« Reply #8 on: April 10, 2020, 06:18:27 pm »
I concentrate on the functionalities of applications BUT when I want the GUI to look pretty fine EASY I personnaly embed my GUI with no border shifted inside a (fake)shadowing alphablended 'shaped' form
... then my GUIs can compete with 'professional' enlighted widgetsets with little minimal effort  :P
Results are impressive / amazing
« Last Edit: April 10, 2020, 06:24:44 pm by mercurhyo »
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

furious programming

  • Hero Member
  • *****
  • Posts: 852
Re: Custom Drawing user interface
« Reply #9 on: April 10, 2020, 06:37:00 pm »
The border of any window is controlled by the OS, not the application.

What about WM_NCPAINT?

Quote
Nothing stops you from setting your borderstyle to bsNone and draw your own (though you also need to handle window movement yourself then).

Yep, but if I set the BorderStyle to bsNone, then I will automatically lose the system context menu, which is available by clicking LMB on the form icon or RMB on caption bar, or by pressing Alt+Space. And, because of this, I will lose the whole system mechanism to moving and resizing the form too.


I'm constantly thinking about custom skin for my application, because I need a dark skin and the controls' appearance similar to those on Windows 10, available on any OS and not dependent on system theme. But, at the same time, I want to use basic LCL controls, because those are used in the whole project.

And I have no idea what to do... Maybe hack/override the current widgetset? 8)
« Last Edit: April 10, 2020, 06:43:45 pm by furious programming »
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

mercurhyo

  • Full Member
  • ***
  • Posts: 242
Re: Custom Drawing user interface
« Reply #10 on: April 10, 2020, 07:07:33 pm »

What about WM_NCPAINT?


NOT portable. So if you build apps for Windoze only, you can dispatch the 'NC' non client 'WM' windoze(c) messages BUT if you plan to build apps for other OSes, NOWAY

WM_NCxxx simply don't exist on other OSes
« Last Edit: April 10, 2020, 07:09:52 pm by mercurhyo »
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

furious programming

  • Hero Member
  • *****
  • Posts: 852
Re: Custom Drawing user interface
« Reply #11 on: April 10, 2020, 07:09:17 pm »
Windows rocks — again. 8-)
Lazarus 3.2 with FPC 3.2.2, Windows 10 — all 64-bit

Working solo on an acrade, action/adventure game in retro style (pixelart), programming the engine and shell from scratch, using Free Pascal and SDL. Release planned in 2026.

mercurhyo

  • Full Member
  • ***
  • Posts: 242
Re: Custom Drawing user interface
« Reply #12 on: April 10, 2020, 07:11:56 pm »
Windows rocks — again. 8-)

rock in a torrent  :D :D :D :D :D :D :D :D :D :D :D

there are so many holes of securities in that torrent, and so many (especialy multithreding) leaks that made me call it 'windoze'
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Custom Drawing user interface
« Reply #13 on: April 10, 2020, 07:14:43 pm »
NOT portable.
That depends on the definition of portable.  My definition of portable is: put it on a USB drive and run it without any "unusual" dependencies such as a C runtime library (dll), IOW, a stand alone program.

WM_NCxxx simply don't exist on other OSes
There are other O/Ss ? ... good to know.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

mercurhyo

  • Full Member
  • ***
  • Posts: 242
Re: Custom Drawing user interface
« Reply #14 on: April 10, 2020, 07:18:08 pm »
98% servers run UNIX systems
77% smartphones run UNIX systems

so if you talk 'windoze' to me i can return the 'compliment'
A Writer said 'Mind is just like parachute! it only works when you open it'!

so talking your windoze crap 'only' is closing the parachute  on your side :P :P :P
« Last Edit: April 12, 2020, 08:40:18 am by mercurhyo »
DEO MERCHVRIO - Linux, Win10pro - Ryzen9XT 24threads + Geforce Rtx 3080SUPRIM
god of financial gain, commerce, eloquence (and thus poetry), messages, communication (including divination), travelers, boundaries, luck, trickery and thieves; he also serves as the guide of souls to the underworld

 

TinyPortal © 2005-2018