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 ]
BROWSE has no place in applications. In FoxPro 2.x, you could make some argument for it because there were no good alternatives. You either used BROWSE or lived without its row-at-a-time view of data. In Visual FoxPro, you can use a grid for that view and ignore BROWSE except as a powerful, interactive tool for you, the developer. As for CHANGE/EDIT, it's been obsolete for a long time.BROWSE does have one clause in Visual FoxPro worth learning. A BROWSE is really just a grid, although you can't find a BROWSE's Parent. The NAME clause lets you manipulate the grid with its PEMs, instead of relying on the same old confusing, complex clauses. The table below maps BROWSE's clauses to the grid and column properties, events and methods that give you the same (or often better) functionality.

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")
This one's an antique dating back before Windows and its status bar. It determines what happens when you open a BROWSE and there's no visible status bar. If BRSTATUS is ON, the Xbase-style status bar appears.

See Also

Grid


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .