Hackers Guide to Visual FoxPro 7.0
Browse, Change, Edit, Set BrStatus
The desire of power in excess caused the angels to fall; the desire of knowledge in excess caused man to fall.
Francis Bacon, Of Goodness and Goodness of Nature, 1625
What can we say about BROWSE? It's a contender for the most complex and powerful command in the language. It's also a contender for the most dangerous—handing an unknowing user a BROWSE without appropriate safeguards is like giving a toddler a magnet and your backup tapes. CHANGE and EDIT are just other names for BROWSE. They present the same data in a different format. SET BRSTATUS determines whether you get a status bar when you're in a BROWSE, even if you've turned the status bar off.| Usage | BROWSE [FIELDS FieldList] [ NAME ObjectName ] [ FOR lForExpr [ REST ] ] [ KEY eLowKeyValue [ , eHighKeyValue ] ] [ LAST | NOINIT ] [ PREFERENCE PreferenceName ] [ NORMAL ] [ FREEZE FieldName ] [ PARTITION nColumnNumber [ LEDIT ] [ REDIT ] ] [ LPARTITION ] [ LOCK nNumberOfFields ] [ NOLGRID ] [ NORGRID ] [ NOLINK ] [ NOAPPEND ] [ NODELETE ] [ NOEDIT | NOMODIFY ] [ NOMENU ] [ NOOPTIMIZE ] [ NOREFRESH ] [ NOCAPTIONS ] [ NOWAIT ] [ SAVE ] [ TIMEOUT nSeconds ] [ WHEN lWhenExpr ] [ VALID [ :F ] lValidExpr [ ERROR cErrorMessage ] ] [ [ WINDOW DefinitionWindow ] [ IN [ WINDOW ] ContainingWindow | IN SCREEN | IN MACDESKTOP ] ] [ TITLE cTitleText ] [ FONT cFontName [, nFontSize ] ] [ STYLE cStyleCodes ] [ COLOR SCHEME nScheme | COLOR ColorPairList ] [ WIDTH nFieldWidth ] [ NOCLEAR ] [ FORMAT ] |
| Clause | PEM | Purpose |
| FIELDS | ColumnCount, Columns' ControlSource | Determine which fields appear. |
| FREEZE | Columns' ReadOnly | Keep fields from being edited. FREEZE specifies a single editable field. ReadOnly lets you decide for each field. |
| PARTITION, LOCK | Partition | Split the BROWSE/grid into two panes. |
| LEDIT, REDIT | View | Determine the editing mode for each pane. |
| LPARTITION | Panel | Determine which pane has focus. |
| NOCAPTIONS | Columns' Header's Caption | For tables and views in databases, uses the field name regardless of whether a "friendly" caption has been defined. |
| NOLGRID, NORGRID | GridLines | Determine whether the grid (or a single pane) has lines dividing rows and columns. |
| NOLINK | PanelLink | Determine whether the two panes are linked together. |
| NODELETE | DeleteMark | NODELETE prevents the user from deleting records. DeleteMark determines whether a deletion column shows at all. Without it, records can't be deleted. |
| NOEDIT, NOMODIFY | ReadOnly | Prevent the user from making any changes to data in a grid. |
| WHEN | When, AfterRowColChange | Determine whether you can enter grid or cell. |
| VALID | Valid, BeforeRowColChange | Test record for validity as you leave. |
| FONT | FontName, FontSize | Determine the font used for the BROWSE/grid. |
| STYLE | FontBold, FontItalic, FontStrikeThru, FontUnderline | Determine the characteristics of the font. |
| COLORSCHEME, COLOR | BackColor, ForeColor, GridLineColor | Determine the colors used. |
| WIDTH | Columns' ColumnWidth | Determine the width of individual columns in the grid. |
While not every clause has a corresponding property or event, enough of them do to reduce what you have to do with BROWSE itself to pretty minimal—a good thing.
One item here is worth noting. Despite the fact that it's not even documented for VFP 6 and later, the IN MACDESKTOP clause creates a free-floating browse window with its own entry on the taskbar.| Example | * BROWSE is great when you're working interactively. USE Customer BROWSE FIELDS Company_Name,Contact_Name,Phone |
| Usage | SET BRSTATUS ON | OFF cBrStatus = SET("BRSTATUS") |
| See Also | Grid |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.
Категории