Hackers Guide to Visual FoxPro 7.0
Caption
This property is a true example of polymorphism at work. It contains a user-definable string for every control that has a Caption, but the exact use of the string varies rather a lot from one control to the next.| Usage | oObject.Caption = cCaptionString cCaptionString = oObject.Caption |
| | Headers can't handle hotkeys. That's okay—we're not totally sure what they'd mean there anyway. What's not okay is that when you type the hotkey characters "\<" into the Caption of a header, it leaves them there. That is, not only don't they get replaced with an underline, but they don't get removed from the string. You can sort of specify a hotkey for a header with "&", which is the Windows-standard character for hotkeys. When you do, you get an underlined letter, but that still doesn't actually give you a live hotkey—no event fires when the user presses Alt+the specified key. |
Keep in mind that SET KEYCOMP affects the use of hotkeys—with KEYCOMP set to DOS, hotkeys don't always work. (However, there's really no reason to SET KEYCOMP TO DOS anymore, since there's no DOS version of VFP.)
In check boxes, option buttons and command buttons, you can combine the caption with a picture. However, there's no way to specify their relative position. The picture always goes over the caption. In the rare cases where we have needed a bitmap with a caption next to, or on top of, the bitmap, we've cheated by using an empty Caption and placing the text in the bitmap itself. Beware of this technique, however—it can cause problems with some of the accessibility tools that users with disabilities depend on. In VFP 3 and VFP 5, to create a completely borderless form, Caption needed to be empty. (See BorderStyle for a complete list of settings needed for borderless forms.) In VFP 6 and later, TitleBar makes this a lot easier, and messing with Caption is unnecessary.| Example | ThisForm.Caption = "Favorite Things" * You can change the title on the main Visual FoxPro window: _SCREEN.Caption = VERSION() * Here's a button with a hotkey: ThisForm.cmdClose.Caption = "\<Close" |
| See Also | Alignment, AutoSize, BorderStyle, Name, Picture, Set KeyComp, Style, TitleBar |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.
Категории