[Lazarus] Color setup of the Form1: TForm1

Kostas Michalopoulos badsector at slashstone.com
Tue Jun 17 18:39:39 CEST 2008


> the themes in linux control everything about the widgets, that means
> everything on my desktop looks the same (not in terms of application
> design, but buttons, scrollbars, borders, colours of active/inactive
> titlebars, shades, translucency, etc).
>
> if you need a custom look, you either need to build a themeing engine
> into lazarus, or write a gtkrc file for your app (the right way, imo).
> then you can control everything.  if you just need a colour for your
> form, doesn't a panel work?  (coloured panels work for me in gtk2, at
> least).

First of all, Linux is not GTK+. There are other toolkits around, like Qt 
and FLTK which have their own theming stuff. However X11, the windowing 
system that is mostly used in Linux and other UNIX environments (which is 
*NOT* even guarranteed that it will be the one used - i've seen some other 
UIs which use the framebuffer directly) does not dictate a specific window 
look or behavior. While GTK+ came to be a well known and widely used toolkit 
(which is something that can be said about Qt too), it doesn't make it "the 
way Linux looks like".

While you can restrain yourself to not use anything non-GTK, if you open a 
non-GTK program (like a Qt program, a FLTK program, a Motif/Lesstif program, 
a Tcl/Tk program, etc) it will not look the same as the rest. This is 
because there is no universally acceptable theme engine that applies to all 
toolkits. I'm not going to argue if this is good or bad, but thats the fact.

Secondly, even if there was a "Linux theme engine", the same applies to 
Windows programs. Windows in fact *have* a theme engine and even since 
Windows 3.0 (i think) you were able to change the current theme to something 
else. However as i see, the Win32 backend allows you to change colors, while 
GTK+ does not. While i can accept that doing such a thing in GTK+ is a very 
low priority (which would imply, however, that GTK+ is not finished and if 
1.0 has to have GTK+ 1.2 finished then it has to provide this functionality 
too), i find the answer of not doing it because the theme engine dictates 
look as a cheap excuse (because otherwise if you really believe this, then 
rip off the code that changes colors in Win32 from LCL too - there is a 
theme engine there much older and widely used than GTK+'s).

And third, what you propose here is a platform-specific solution. Lazarus is 
supposed to be "write once, compile everywhere" not "write once (while 
praying that your code will work in other interface), compile everywhere (to 
find bugs and missing features in other interfaces and platforms)". In the 
very worst case (which is a hack) Lazarus should create the gtkrc file 
transparently from the user/programmer.

Of course i think the best solution for all these problems would be a 
crossplatform toolkit that sits below LCL and has a constant behavior no 
matter what the system is. fpGUI seems to be such a kit, but setting Lazarus 
to compile with this toolkit is failing due to some missing unit.

Kostas




More information about the Lazarus mailing list