Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

TitleBar

This property, added in VFP 6, makes creating a form without a title bar a whole lot easier.

Usage

oForm.TitleBar = nHasTitleBar
nHasTitleBar = oForm.TitleBar

Parameter

Value

Meaning

nHasTitleBar

0

The form has no title bar.

1

The form has a title bar.

Before this property was added, removing the title bar from a form (say, to create a splash screen) was a pain. You had to set a whole bunch of properties. (See BorderStyle for the whole list.) Now you need just one, and all the others don’t matter.

This property is another case of a C influence on VFP. There's no reason on earth why this property should be numeric. There are only two possible values. Unless, of course, the designers are thinking of giving us other choices here, like, say, title bars at the bottom or on the sides.

What we want to use this property for most is creating splash screens. Unfortunately, a bug means we can't create a generalized splash screen class. When a form class has TitleBar set to 0 and ShowWindow set to 2 ("as top-level form"), forms instantiated from that class have a title bar anyway. (VFP 5 has the same bug, except that to see it, you have to set that whole collection of properties that give a form without a title bar.)

Oddly, forms (the DO FORM kind) created with TitleBar = 0 and ShowWindow = 2 work just fine.

Example

* Check whether the active window has a title bar
IF _SCREEN.ActiveForm.TitleBar = 1
   _SCREEN.ActiveForm.Caption = "April Fool!"
ENDIF

See Also

BorderStyle, Caption, Closable, ControlBox, MaxButton, MinButton, Movable, ShowWindow