Command APPFIELD Foundation

Specifies a database field to be displayed in an Application Part.

Syntax
 APPFIELD <cFieldName> | <memvar> := <expression> ;
   [ INTO   <oApp>  ] ;
   [ TYPE   <cType> ] ;
   [ LEN    <nLen>  ] ;
   [ DEC    <nDec>  ] ;
   [ FONT   <cFontCompoundName> ] ;
   [ COLOR  <nForeGround1> [, <nBackGround1>] ] ;
   [ HILITE <nForeGround2> [, <nBackGround2>] ] ;
   [ ALIGN LEFT | CENTER | RIGHT ] ;
   [ WIDTH  <nWidth> ] ;
   [ READONLY ] ;
   [ HEADING | CAPTION <cHeading>    ;
     [ FONT  <cFontCompoundName> ] ;
     [ COLOR <nForeGround> [, <nBackGround>] ] ;
     [ ALIGN LEFT | CENTER | RIGHT> ] ;
   ] ;
   [ FOOTING | COMMENT <cFooting>   ;
     [ FONT  <cFontCompoundName> ] ;
     [ COLOR <nForeGround> [, <nBackGround>] ] ;
     [ ALIGN LEFT | CENTER | RIGHT ] ;
Parameters
<cFieldName>
<cFieldName> is a literal field name or a character expression in parentheses. It defines the database field to be displayed next in an Application Part.
<memvar> := <expression>
If an Application Part is to display not a field but the result of an expression, an assignment must be specified, instead of a field name. The assignment must be coded using the inline assignment operator (:=). An expression is to be assigned to a memory variable (LOCAL, STATIC, PRIVATE or PUBLIC). <memvar> is the name for this variable and the result of <expression> is assigned to it, each time the record pointer is moved.
<oApp>
<oApp> is the name of the memory variable that references an Application Part. It defaults to appObject (refer to the INTO clause of APPEDIT or APPBROWSE).
<cType>
<cType> is an upper case letter that optionally specifies the data type of the field <cFieldName>.
<nLen>
<nLen> is a numeric value that optionally specifies the length of the field <cFieldName>.
<nDec>
<nDec> is a numeric value that optionally specifies the number of decimal places of the field <cFieldName>.
<cFontCompoundName>
The FONT clause optionally specifies a character string defining the compound name of the font to be used for displaying a field (see also the :setFontCompoundName() method of Xbase Parts).
<nForeGround1> [, <nBackGround1>]
The COLOR option specifies foreground and background color for the display of a single field. #define constants from XBP.CH or GRA.CH must be used (XBPSYSCLR_* or GRA_CLR_*).
<nForeGround2> [, <nBackGround2>]
The option HILITE defines foreground and background color for hilighted display of a field. This option is used differently in different Application Parts. For APPBROWSE it defines the color of the cell cursor, while APPEDIT uses it as color to mark text in an entry field.
LEFT | CENTER | RIGHT
The option ALIGN defines alignment of displayed data: left, center or right.
<nWidth>
<nWidth> defines the width of a field for display. It is a numeric value and corresponds to "number of characters". The width is calculated from the expression Replicate("W",<nWidth>), because W is the widest character in a proportional font.
READONLY
The option READONLY suppresses the possibility to edit a field. READONLY is always set when APPFIELD is not used with a field name, but with an assignment (<memvar> := <expression>).
| CAPTION <cHeading> [ <Options> ]
<cHeading> is a character string that is displayed as column heading with APPBROWSE, and as caption of an entry field with APPEDIT. The key words COLOR, FONT and ALIGN can be used for <Options>. This allows to define color, font and alignment for a single column heading or caption.
| COMMENT <cFooting> [ <Options> ]
<cFooting> is a character string that is displayed as column footing with APPBROWSE, and as message in the status line with APPEDIT. The key words COLOR, FONT and ALIGN can be used for <Options>. This allows to define color, font and alignment for a single column heading or message.
Description

The APPFIELD command is used to configure the display of single fields in Application Parts in greater detail, compared to the available options of the APPEDIT or APPBROWSE command. In addition, APPFIELD allows to define an expression, rather than a field, whose result is displayed in an Application Part. This is coded as an assignment, where the inline assignment operator must be used to assign the result of an expression to a memory variable.

The APPFIELD command can only be used after a command that creates an Application part. For example, the command APPEDIT or APPBROWSE must be executed in a program before APPFIELD may be used. When an Application Part is displayed with APPDISPLAY, the APPFIELD command must not be used until the next Application Part is created.

Examples
Detailed field specifications for Application Parts

// The APPFIELD command is executed in the example between 
// APPEDIT and APPDISPLAY. This defines fields for APPEDIT 
// without using the APPEDIT...FIELDS option. The first field 
// displays an expression (current record pointer position). 
// This field cannot be edited. 

#include "Appedit.ch" 
#include "Gra.ch" 

MEMVAR appObject 


PROCEDURE AppSys 
// Desktop remains application window 
RETURN 

PROCEDURE Main 
   LOCAL nVar 

   USE Customer                     // Open database 

   APPEDIT  STYLE FANCY ;           // Define edit dialog 
  POSITION  CENTER ; 
   HEADING "Customer Address" ; 
            COLOR GRA_CLR_CYAN, GRA_CLR_BLUE ; 
             FONT "24.Helvetica" ; 
   CAPTION  COLOR GRA_CLR_BLUE ALIGN RIGHT 

                                    // Define expression 
   APPFIELD nVar := Recno()  CAPTION  "Record number" 

                                    // Define fields 
   APPFIELD FIRSTNAME  COLOR GRA_CLR_RED 
   APPFIELD LASTNAME   COLOR GRA_CLR_YELLOW, GRA_CLR_BLUE 
   APPFIELD STREET   COMMENT "This is field 'STREET  '" 
   APPFIELD CITY     COMMENT "This is field 'CITY    '" 
   APPFIELD ZIP      COMMENT "This is field 'ZIP     '" 
   APPFIELD NOTES    COMMENT "This is field 'NOTES   '" 

   APPDISPLAY                       // Display AppEdit window modal 
RETURN 
Feedback

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.