Command APPBROWSE Foundation
Creates an Application Part to browse databases
APPBROWSE ;
[ INTO <oAppBrowse> ]
[ FIELDS <cFieldNames,...> ] ;
[ PARENT <oParent> ] ;
[ POSITION <pos1> [, <pos2>] ] ;
[ SIZE <size1> [, <size2>] [ PERCENT ] ] ;
[ TITLE <cTitle> ] ;
[ COLOR <nForeGround1> [, <nBackGround1> ] ] ;
[ FONT <cFontCompoundName> ] ;
[ HILITE <nForeGround2> [, <nBackGround2> ] ] ;
[ STYLE PLAIN | 3D | FANCY | <nStyle> ] ;
[ ALIAS <cAlias> ] ;
[ FOR <lForCondition> ]
<pos1> | Value | <pos2> | Value | Description |
---|---|---|---|---|
Array | {nX,nY} | n.a. | NIL | <pos1> is an array containing grafic coordinates for the AppBrowse window |
Numeric | nRow | Numeric | nCol | <pos1> is a numeric value used as row coordinate, and <pos2> specifies the column coordinate according to a text mode window |
Key word | TOP | Key word | TOP | The AppBrowse window is displayed |
Key word | LEFT | Key word | LEFT | at the top, left, bottom, right |
Key word | BOTTOM | Key word | BOTTOM | and/or centered within its parent, |
Key word | RIGHT | Key word | RIGHT | according to the keywords used |
Key word | CENTER | Key word | CENTER | for positioning |
<size1> | Value | <size2> | Value | Description |
---|---|---|---|---|
Array | {nXsize,nYsize} | n.a. | NIL | A two element array defines the size in pixel |
Numeric | nHeight | Numeric | nWidth | Two numeric values specify the number of rows and columns according to a text mode window |
Constant | Description |
---|---|
APPSTYLE_FANCY | Is equal to STYLE FANCY |
APPSTYLE_3D | Is equal to STYLE 3D |
APPSTYLE_PLAIN | Is equal to STYLE PLAIN |
APPSTYLE_NOBORDER | The border of the dialog window is suppressed |
APPSTYLE_NOTITLEBAR | The title of the dialog window is suppressed |
APPSTYLE_NOFRAMECONTROLS | Control elements in the title bar are suppressed (maximize, minimize button and system menu) |
The command APPBROWSE defines an Application Part (APP) that displays databases. It creates an object of the AppBrowse class which is a container for a GUI browser. The minimum requirements to display a database are three lines of code:
USE Customer NEW
APPBROWSE
APPDISPLAY
These three lines open a database (USE), create an AppBrowse object (APPBROWSE), and display it (APPDISPLAY). In this case the browser displays all database fields. All other options of the APPBROWSE command are used to configure the browser in detail or to specify the fields to be displayed.
Key word | Description |
---|---|
PARENT | Defines the parent |
POSITION | Positions the AppBrowse window within the parent |
SIZE | Defines the size of the AppBrowse window |
TITLE | Character string to be displayed in the title bar |
COLOR | Defines colors for table columns |
FONT | Defines font for table columns |
HILITE | Defines colors for browse cursor |
STYLE | Defines display style |
The most important options for display are PARENT, STYLE, POS and SIZE.
PARENT
The key word PARENT decides whether or not an AppBrowse object is displayed within its own dialog window. When the option PARENT is used, the browser is displayed without a dialog frame within the parent window. If PARENT is not specified, the AppBrowse window is created having its own dialog window. It is then displayed on the desktop window (AppDesktop()).
STYLE
The option STYLE defines the appearance of an AppBrowse window. The default style is 3D. Three predefined styles can be selected for an AppBrowse window using key words: STYLE PLAIN, STYLE 3D and STYLE FANCY.
POS
The option POS allows to position an AppBrowse window within its parent window using different units for coordinates. The units 'pixel', 'text coordinates' and the key words TOP, LEFT, BOTTOM, RIGHT, CENTER are supported. This provides maximum flexibility for positioning of an AppBrowse window. Different possibilities are shown below:
POS {100,200} // Array => x,y coordinates in pixel
POS 10, 20 // Numeric => Row and column coordinates
POS LEFT
POS TOP,CENTER // Key words => Default positions
A pixel-exact positioning is achieved with a two element array containing graphic x,y coordinates (the origin of the coordinate system is bottom, left). Numeric values are interpreted as row and column text-coordinates (the origin is top, left). Using key words an AppBrowse window can be placed at well defined positions. The key word LEFT means, for example, that the AppBrowse is displayed on the left side of its parent window. TOP, CENTER displays it at the top and centers it horizontally.
SIZE
The option SIZE defines the size of the display area of the AppBrowse window (this is equal to the size of XbpDialog:drawingArea). A two element array defines the size in x and y direction (width and height), the unit is 'pixel'. Numeric values specify the number of rows and columns according to a text-mode window. If the key word PERCENT is specified, numeric values are used as percentage to calculate width and height from the size of the parent window (range 0-100).
Options for database access
The next table list all options relevant for database access:
Key word | Description |
---|---|
FIELDS | Names of fields to be displayed |
ALIAS | Alias name of the work area used for navigation |
FOR | Condition for database records to display |
If database navigation is not to take place in the current work area, the alias name of the corresponding work area must be specified with the ALIAS option. The option FIELD specifies the fields to be displayed in the AppBrowse window. Field names must be programmed as literals or as character expressions in parentheses. If fields from multiple work areas are to be displayed, the field names must be alias referenced. Table columns in the browser are displayed in the same order like the fields are specified. Instead of using the FIELDS option, fields can be specified using the APPFIELD command prior to displaying the browser with APPDISPLAY. If neither FIELDS nor APPFIELD is used the browser contains columns for all fields of the specified work area.
The FOR option defines a logical condition. If it is used, only those records are displayed where the condition yields the value .T. (true).
// The example demonstrates the sequence of commands necessary
// to create and display a GUI browser. The browser is displayed
// modal. Therefore, an event loop is not necessary.
#include "Appbrow.ch"
MEMVAR appObject
PROCEDURE AppSys
// Desktop remains application window
RETURN
PROCEDURE Main
USE Customer // Open database
APPBROWSE ; // Define browser
FIELDS Firstname, Lastname, Phone, Street, Zip, City ;
TITLE "Address List" ;
POSITION TOP, CENTER ;
SIZE 40, 60 PERCENT
APPDISPLAY // Display browser modal
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.