38209 ThemedTitleBar

38236

Project Manager: Markus Winhard

*38362 Download latest release

*38362 If you have questions or find bugs, please use the DISCUSSIONS button above.

The TitleBar of a VFP form displayed ‘In Screen’ or ‘In Top-Level Form’ looks a bit outdated nowadays. At least running in Win8 and compared to Office 2013 or Visual Studio 2013. This project provides a modern drop-in replacement for the default TitleBar, requiring no code changes to existing forms.

Before adding ThemedTitleBar:
FormWithoutThemedTitleBar.PNG

After adding ThemedTitleBar:
FormWithThemedTitleBar.PNG

How to:
  1. Include ThemedTitleBar.vcx and ThemedTitleBarBase.vcx in your project.
  2. Drop the ThemedTitleBar class on every form where you want to use it.
That's it.

Run the form ThemedTitleBarSample.SCX to see an example.

Tweaks:
  • Performance is better if all your forms use the same ThemedTitleBarSettings instance. To do so, write this line in your main program: _Screen.NewObject( "ThemedTitleBarSettings", "ThemedTitleBarSettings", "ThemedTitleBar.vcx" )
  • If you want to change default behavior or property values, feel free to overwrite methods and properties of the classes in ThemedTitleBar.VCX. This way you can use later versions of my ThemedTitleBarBase.VCX and don't lose your settings.
  • Change ThemedTitleBarSettings.nTitleBarBackColor and .nTitleBarforeColor to use different colors.
  • Write Thisform.ThemedTitleBar1.BackColor=RGB(...) in your form's Init() to give a special form a different TitleBar BackColor.
  • ThemedTitleBar.lAutoMoveFormControls=.T. (default) moves the controls on your form downward to make room for itself. This happens between first Form.Show() and first Form.Activate(). Set to .F. to suppress this behavior.
  • Add properties ThemedTitleBarDescription and ThemedTitleBarImage to your form base class. Set them at the form level. The sample form shows how to use it.
  • If you don't like the property names ThemedTitleBarDescription and ThemedTitleBarImage you can change them in the ThemedTitleBar class. Please see it's properties cDesciptionProperty and cImageProperty.
  • ThemedTitleBarSettings checks if a font listed in it's properties cCaptionFontFamily and cDescriptionFontFamily is available. The list of fonts is comma separated. The first available font is used.
  • If you're using a resizer on your form and don't want it to change ThemedTitleBar's height, try setting Thisform.ThemedTitleBar1.lFixedHeight = .T.
  • If you want all your forms to use ThemedTitleBar, write code like this in your form baseclass' Init():
Thisform.NewObject( "ThemedTitleBar1", "ThemedTitleBar", "ThemedTitleBar.vcx" )
Thisform.ThemedTitleBar1.Visible = .T.

Full source code history of ThemedTitleBar is hosted in the repository under the SOURCE CODE button above.

Last edited Apr 20, 2015 at 4:55 PM by mw, version 31

Comments

krylovsn Sep 26 at 3:42 PM 
I have to change some properties - on Maximize button click event there should be string added:
This.MouseLeave

Unfortunately I could not change or set description. Tried adding property to the form but nothing seems to work. Any help?

devilzito Feb 24 at 7:52 PM 
Hola, excelente clase. Las pantallas quedan muy bonitas. Pero tengo una situación.

En ocasiones al tratar de mover la ventana (por la nueva área que se habilita para eso), no se mueve la pantalla en sí, sino la que está detrás. O sea se pierde la capaccidad de mover la ventana correctamente.

También me sucede luego de ejecutar un informe en vista preliminar.

¿Les ha ocurrido?

Gracias

Bitnetsoft Aug 18, 2015 at 3:13 PM 
Goo job Markus, I love that.

A question, you can make the icon size and the letter is much smaller ?, the idea is to make everything fit into a single line without description or second line in the title.

In spanish: Una pregunta, ¿se puede hacer que el tamaño del icono y de la letra sea mucho mas pequeña?, la idea es hacer que todo quede en una sola linea sin descripción o segunda linea en el titulo.

dCipher Jul 9, 2015 at 8:41 PM 
If you click the "Change MinButton" so that it is smaller in size and then click "Change MaxButton" both buttons disappear. If you click the "Change MinButton" so that it is smaller in size and then click "Change CloseButton" and then click "Change MaxButton" all three buttons disappear. I assume this is not the desired result.

beroni Jun 16, 2015 at 5:25 PM 
I am using it, and ThemedTitleBar give to our apps a second life. Thanks.

jorgalvan Apr 30, 2015 at 3:29 PM 
Event: MOVEFORMCONTROLS


end the event

IF thisform.AutoCenter
thisform.Top = thisform.Top - INT(this.Height/2)
ENDIF

****
this modification is that when this active AutoCenter = .T.

the form is centered

jorgalvan Apr 28, 2015 at 10:11 PM 
Excelente clase, pero tengo un problema en mi formulario le habilito la opción AutoCenter = .T. pero no esta centrado el formulario esta mas abajo y no queda centrado. como puedo corregir este problema. Gracias

mw Feb 23, 2015 at 11:00 AM 
@ALL: PLEASE USE THE DISCUSSIONS BUTTON ABOVE FOR QUESTIONS.
@lenyfox: Please see my reply in discussions.

lenyfox Feb 23, 2015 at 5:22 AM 
Nice class, thanks. btw is it possible make different backcolor for each form?
which I mean, one form in red and the other in blue but still in one project.

JaimeCardona Feb 5, 2015 at 4:46 AM 
Muchas Gracias, Excelente Clase!
Hi Markus this class is great, thank you!

mw Jan 18, 2015 at 3:35 AM 
@ALL: PLEASE USE THE DISCUSSIONS BUTTON ABOVE FOR QUESTIONS.

mw Jan 18, 2015 at 3:33 AM 
@RickBorup: Sorry for the inconvenience. Looks like I didn't completely remove the SourceSafe bindings of the project. I will upload a new update in a few minutes.

mw Jan 18, 2015 at 3:20 AM 
@RickDD: First of all, the right place for your change is in ThemedTitleBarSettings.nTitleBarBackColor. Why? Because there I won't overwrite your change with my next update. But anyway, I just tried what you did and set ThemedTitleBarSettingsBase.nTitleBarBackColor=255. Now the TitleBar of the sample form is red.

RickBorup Jan 16, 2015 at 5:43 PM 
A Project Error dialog with the message "An unspecified registry error occurred" is displayed when opening the project themedtitlebar.pjx and making the current folder the new home folder. There are no apparent issues after dismissing that dialog, though. (Windows 7 32-bit and also 64-bit.)

thesuhu Jan 16, 2015 at 7:36 AM 
many thanks, nice man

RickDD Jan 13, 2015 at 12:13 PM 
Hi Markus, thank you for this project!
I have one question for you, i tried to modify backcolor from ThemedTitleBarSettingsBase.vcx at the property ntitlebarbackcolor but nothing changed, can i modify the back color in some way?
Thanks, best regards
Rick

mw Jan 12, 2015 at 11:22 PM 
It works on Top Level Forms but not on _Screen. I don't think there's an easy way to fix this. Moreover when you have a Toolbar or a Menu it's shown above ThemedTitleBar. Probably not what you want.

SchneiderJH Jan 12, 2015 at 10:16 AM 
Hi Markus! Nice Project! Exactly what we are looking for ;) Is it same possible with the VFP Main form (_screen)?

mw Jan 8, 2015 at 10:42 AM 
Added screenshots as requested.

mattslay Jan 3, 2015 at 10:56 PM 
Would someone please add a screenshot to show the result of using this tool.