SP_EDITMEMOV

EDITMEMOV()

  Short:
  ------
  EDITMEMOV() Performs a windowed memoedit() on a string

  Returns:
  --------
  <cBuffer> => changed string

  Syntax:
  -------
  EDITMEMO(cBuffer,[nTop,nLeft,nBottom,nRight],[lModify],;
            [nLineLength],[cTitle])

  Description:
  ------------
  Pops up a box allowing memo editing of a string.
  Edits string <cBuffer>. Options for import and export as well.

  Escape exits, F10 saves [cBuffer]. Uses coordinates
  2,10,20,69 unless passed coordinates as
  [nTop,nLeft,nBottom,nRight]

  [lModify] - True = allow edit (default), False = view
  only

  [nLineLength] - line length - default is window
  width-1

  [cTitle]  Title (max 25 characters) Default is MEMO PAD (new to 3.5)

  Examples:
  ---------
   cNew := editmemov("Good golly miss molly!")
   cNew := editmemov(memoread("DOCS.DOC"),2,2,22,78)
   cNew := editmemov(memoread("DOCS.DOC"),2,2,22,78,.f.)

  Notes:
  -------
  If editing, must have a box width of at least 50.
  Unlike EDITMEMO, this works on a memvar and returns a memvar.

  Source:
  -------
  S_EDITM.PRG

 

SP_EDITMEMO

EDITMEMO()
  Short:
  ------
  EDITMEMO() Performs a windowed memoedit() on a memo field

  Returns:
  --------
  <lChanged> -> Was the memo field changed

  Syntax:
  -------
  EDITMEMO([cMemoName],[nTop,nLeft,nBottom,nRight],;
        [lModify],[nLineLength],[cTitle])

  Description:
  ------------
  Pops up a box allowing editing of a memo field.
  Escape exits, F10 saves.

  Options for import and export as well.

  Edits field named MEMO by default, otherwise edits
  fieldname passed as [cMemoName]. Uses coordinates 2,10,20,69
  unless passed coordinates as [nTop, nLeft, nBottom, nRight]

  [lModify] - True = allow edit (default), False = view only

  [nLineLength] - line length - default is window width-1

  [cTitle]  Title (max 25 characters) Default is MEMO PAD (new to 3.5)

  Examples:
  ---------
   editmemo()
   editmemo("NOTES")
   editmemo("NOTES",2,2,22,78)
   editmemo("NOTES",2,2,22,78,.f.)

  Notes:
  -------
  If editing, must have a box width of at least 50
  Requires a memo FIELD - will not work on a memvar.

  See EDITMEMOV() to edit memvars.

  Source:
  -------
  S_EDITM.PRG

 

SP_BXX

BXX()

  Short:
  ------
  BXX() Draws a box on the screen of a given color

  Returns:
  --------
  Nothing

  Syntax:
  -------
  Bxx(nTop,nLeft,nBottom,nRight,[nColor],[nShadow],;
                      [nShadowColor],[cFrame])

  Description:
  ------------
  <nTop >      - top row
  <nLeft>      - left col
  <nBottom>    - bottom row
  <nRight>     - right column
  [nColor]     - attribute to box default setcolor()
  [nShadow]    - numeric shadow type  (default 0)
                        follow numeric keypad
                            7 = upper left
                            1 = lower left
                            3 = lower right
                            9 = upper right
                            0 = no shadow

  [nShadowColor] - shadow attribute (default 7 - grey
  on black)

  [cFrame ] - frame string - MUST be 9 characters -
  default single line

  Examples:
  ---------
   BXX(10,10,20,20,47,9,8,"+-+|+-+| ")

  Source:
  -------
  S_BXX.PRG

 

SP_ABORT

ABORT()

  Short:
  ------
  ABORT() Pops up dialog box asking: Abort  Don't Abort

  Returns:
  --------
  <lDoAbort> => True or False

  Syntax:
  -------
  ABORT([cColor],[nTop,nLeft,nBottom,nRight])

  Description:
  ------------
  Tests for escape key press at last wait state. If
  escape key was pressed, pops up a dialog box asking
      [Abort] [Don't Abort]

  Returns True if [Abort], False if [Don't Abort] or
  False if last key was not 27 (escape key).

  Box color is sls_popmenu() or optionally [cColor].
  Box dimensions are: 9,29,13,51 or optionally
  [nTop,nLeft,nBottom,nRight]

  Examples:
  ---------
   INKEY(0)
   IF ABORT()  // test for lastkey() = 27
       exit
   ENDIF

  Source:
  -------
  S_ABORT.PRG

 

C5_@…BOX

 @...BOX
 Draw a box on the screen
------------------------------------------------------------------------------
 Syntax

     @ <nTop>, <nLeft>, <nBottom>, <nRight>
        BOX <cBoxString> [COLOR <cColorString>]

 Arguments

     <nTop>, <nLeft>, <nBottom>, <nRight> define the
     coordinates of the box.  @...BOX draws a box using row values from zero
     to MAXROW(), and column values from zero to MAXCOL().  If <nBottom> and
     <nRight> are larger than MAXROW() and MAXCOL(), the bottom-right corner
     is drawn off the screen.

     BOX <cBoxString> defines a string of eight border characters and a
     fill character.  If <cBoxString> is specified as a single character,
     that character draws the whole box.

     COLOR <cColorString> defines the display color of the drawn box.  If
     not specified, the box is drawn using the standard color setting of the
     current system color as defined by SETCOLOR().  Note that <cColorString>
     is a character expression containing the standard color setting.  If you
     want to specify a literal color setting, enclose it within quote marks.

 Description

     @...BOX draws a box on the screen using configurable border and fill
     characters.  @...BOX draws the box using <cBoxString> starting from the
     upper left-hand corner, proceeding clockwise and filling the screen
     region with the ninth character.  If the ninth character is not
     specified, the screen region within the box is not painted.  Existing
     text and color remain unchanged.

     After @...BOX executes, the cursor is located in the upper corner of the
     boxed region at <nTop> + 1 and  <nLeft> + 1.  ROW() and COL() are also
     updated to reflect the new cursor position.

 Examples

     .  These examples draw two boxes using box manifest constants
        defined in the supplied header file, Box.ch.  The first example draws
        a box using the specified characters for the border, but leaves all
        other areas of the screen intact.  The second example draws the same
        box filling the box region with space characters.

        #include "Box.ch"
        // Draw a box with a double-line top with a
        // single-line side
        @ 1, 1, 22, 79 BOX B_DOUBLE_SINGLE
        // Draw the same box filling the box region with
        // spaces
        @ 1, 1, 22, 79 BOX B_DOUBLE_SINGLE + SPACE(1)

 Files   Library is CLIPPER.LIB, header file is Box.ch.

See Also: @…CLEAR @…TO DISPBOX() SCROLL()

 

C5 Commands

 ?|??            Display one or more values to the console
 @...BOX         Draw a box on the screen
 @...CLEAR       Clear a rectangular region of the screen
 @...GET         Create a new Get object and display it
 @...PROMPT      Paint a menu item and define a message
 @...SAY         Display data at a specified screen or printer row and column
 @...TO          Draw a single- or double-line box
 ACCEPT*         Place keyboard input into a memory variable
 APPEND BLANK    Add a new record to the current database file
 APPEND FROM     Import records from a database (.dbf) file or ASCII text file
 AVERAGE         Average numeric expressions in the current work area
 CALL*           Execute a C or Assembler procedure
 CANCEL*         Terminate program processing
 CLEAR ALL*      Close files and release public and private variables
 CLEAR GETS      Release Get objects from the current GetList array
 CLEAR MEMORY    Release all public and private variables
 CLEAR SCREEN    Clear the screen and return the cursor home
 CLEAR TYPEAHEAD Empty the keyboard buffer
 CLOSE           Close a specific set of files
 COMMIT          Perform a solid-disk write for all active work areas
 CONTINUE        Resume a pending LOCATE
 COPY FILE       Copy a file to a new file or to a device
 COPY STRUCTURE  Copy the current .dbf structure to a new database (.dbf) file
 COPY STRU EXTE  Copy field definitions to a .dbf file
 COPY TO         Export records to a database (.dbf) file or ASCII text file
 COUNT           Tally records to a variable
 CREATE          Create an empty structure extended (.dbf) file
 CREATE FROM     Create a new .dbf file from a structure extended file
 DELETE          Mark records for deletion
 DELETE FILE     Remove a file from disk
 DELETE TAG      Delete a tag
 DIR*            Display a listing of files from a specified path
 DISPLAY         Display records to the console
 EJECT           Advance the printhead to top of form
 ERASE           Remove a file from disk
 FIND*           Search an index for a specified key value
 GO              Move the pointer to the specified identity
 INDEX           Create an index file
 INPUT*          Enter the result of an expression into a variable
 JOIN            Create a new database file by merging from two work areas
 KEYBOARD        Stuff a string into the keyboard buffer
 LABEL FORM      Display labels to the console
 LIST            List records to the console
 LOCATE          Search sequentially for a record matching a condition
 MENU TO         Execute a lightbar menu for defined PROMPTs
 NOTE*           Place a single-line comment in a program file
 PACK            Remove deleted records from a database file
 QUIT            Terminate program processing
 READ            Activate full-screen editing mode using Get objects
 RECALL          Restore records marked for deletion
 REINDEX         Rebuild open indexes in the current work area
 RELEASE         Delete public and private memory variables
 RENAME          Change the name of a file
 REPLACE         Assign new values to field variables
 REPORT FORM     Display a report to the console
 RESTORE         Retrieve memory variables from a memory (.mem) file
 RESTORE SCREEN* Display a saved screen
 RUN             Execute a DOS command or program
 SAVE            Save variables to a memory (.mem) file
 SAVE SCREEN*    Save the current screen to a buffer or variable
 SEEK            Search an order for a specified key value
 SELECT          Change the current work area
 SET ALTERNATE   Echo console output to a text file
 SET BELL        Toggle sounding of the bell during full-screen operations
 SET CENTURY     Modify the date format to include or omit century digits
 SET COLOR*      Define screen colors
 SET CONFIRM     Toggle required exit key to terminate GETs
 SET CONSOLE     Toggle console display to the screen
 SET CURSOR      Toggle the screen cursor on or off
 SET DATE        Set the date format for input and display
 SET DECIMALS    Set the number of decimal places to be displayed
 SET DEFAULT     Set the CA-Clipper default drive and directory
 SET DELETED     Toggle filtering of deleted records
 SET DELIMITERS  Toggle or define GET delimiters
 SET DESCENDING  Change the descending flag of the controlling order
 SET DEVICE      Direct @...SAYs to the screen or printer
 SET EPOCH       Control the interpretation of dates with no century digits
 SET ESCAPE      Toggle Esc as a READ exit key
 SET EXACT*      Toggle exact matches for character strings
 SET EXCLUSIVE*  Establish shared or exclusive USE of database files
 SET FILTER      Hide records not meeting a condition
 SET FIXED       Toggle fixing of the number of decimal digits displayed
 SET FORMAT*     Activate a format when READ is executed
 SET FUNCTION    Assign a character string to a function key
 SET INDEX       Open one or more order bags in the current work area
 SET INTENSITY   Toggle enhanced display of GETs and PROMPTs
 SET KEY         Assign a procedure invocation to a key
 SET MARGIN      Set the page offset for all printed output
 SET MEMOBLOCK   Change the block size for memo files
 SET MESSAGE     Set the @...PROMPT message line row
 SET OPTIMIZE    Change the setting that optimizes using open orders
 SET ORDER       Select the controlling order
 SET PATH        Specify the CA-Clipper search path for opening files
 SET PRINTER     Toggle echo of output to printer or set the print destination
 SET PROCEDURE*  Compile procedures and functions into the current object file
 SET RELATION    Relate two work areas by a key value or record number
 SET SCOPE       Change the boundaries for scoping keys in controlling order
 SET SCOPEBOTTOM Change bottom boundary for scoping keys in controlling order
 SET SCOPETOP    Change top boundary for scoping keys in controlling order
 SET SCOREBOARD  Toggle the message display from READ or MEMOEDIT()
 SET SOFTSEEK    Toggle relative seeking
 SET TYPEAHEAD   Set the size of the keyboard buffer
 SET UNIQUE*     Toggle inclusion of non-unique keys into an index
 SET WRAP*       Toggle wrapping of the highlight in menus
 SKIP            Move the record pointer to a new position
 SORT            Copy to a database (.dbf) file in sorted order
 STORE*          Assign a value to one or more variables
 SUM             Sum numeric expressions and assign results to variables
 TEXT*           Display a literal block of text
 TOTAL           Summarize records by key value to a database (.dbf) file
 TYPE            Display the contents of a text file
 UNLOCK          Release file/record locks set by the current user
 UPDATE          Update current database file from another database file
 USE             Open an existing database (.dbf) and its associated files
 WAIT*           Suspend program processing until a key is pressed
 ZAP             Remove all records from the current database file

 

HMG Samples

About HMG Samples

Language Related

 Arrays

Array Arithmetic

Load / Save ANY array

Conversion

DOS -> Windows Character Conversion

National Issues

National Alternate Collating Sequence

National Change Case

 Windows

Tracking Mouse

Controls

Browse

Quick Search    

Combo box

Dynamic ComboBox

Edit Box

Word wrap in EditBox

 Grid

Get Data Into Grid via IDE

Text Box

Auto fill in text box

Search in and Fill Box (SFilBox) 

Tree

Tree Menu

Two Methods for Tree

Functions

 Drives, Directories and Files

Drives and Directories

Directory List

Fill Directory List

PutFile() with default file name

Messages

HMG Message Functions

Message for multiple values

Message Extended

Where Is It ?

Improvements in Message functions

Miscellaneous

Is application running ?

Get Process ID

Simple Error Handling

Funny

Cuckoo Clock

Untouchable window

Warn Lazy User

Pegs Game

Drawing

Play Draw

Draw Border

Printing

 Text Mode

Using printer under Windows 

Obsolete ways

Send to File

Print File

GUI Mode

HMG Print

 HMG Print ( Mini Print ) for beginners in 10 easy steps

Print a plain text file by HMG Print – 1

HMG Report

HMG HPDF

HMG_HPDF — Bill

Unicode

HMG Unicode

Utilities

Color Codes

DB Validate 

Hex View

Mini Agenda

DBA : Data Base Assistant

Low-Level DBU

x-Base Modul List

Mini Search Machine (2014) 

The Art Of Simplicity

A discussion of how to create objects with Clipper using arrays, and ordinary Clipper syntax. Has several good examples.

An Introduction into Object Oriented Programming.

To me, the challenge of programming is in finding a simple clean way to implement a program. Making sure no matter how complex the specs are, the code itself stays small, strait forward, and easy to maintain.

To illustrate how to reduce the complexity of things, lets examine the box drawing routines. Normally to display a nondestructive box on the screen you write something like this:

 old_row:=row()
 old_col:=col()
 old_cursor:=setcursor()
 old_screen:=savescreen(10, 20, 16, 59)
 old_color:=setcolor("w+/n, w+/r")
 @ 10, 20, 16, 59 BOX 'ÚÄ¿³ÙÄÀ³ '

Then when you are done and wish to remove the box, you reverse the procedure:

 restscreen(10,20,16,59,old_screen)
 setcolor(old_color)
 setcursor(old_cursor)
 setpos(old_row,old_col)

This scheme results in using 9 lines of code, 5 memory variables, and requires that the programmer maintain the box coordinates in 3 different places. After going through this procedure a few times I started wondering if there was a better way of doing this.

When I tried to solve this problem, I had several false starts. I created a procedure to display the box that saved all the variables to statics, and the next time it was called it would restore the box. That didn’t work too well since I often wanted more than a single box on the screen.

Then I tried saving the memvars to an array that I used like a stack. But that didn’t work out too well either, since it required that all boxes be removed in the same order that they were created.

Then I decided that all the memvars being used to store the box information belonged in the calling routine, where they had been all along. Despite the fact that this seemed to bring me back to square one I continued with this train of thought.

If I stored all the memvars being used by the box routine in an array, then all the memvars could be stored in a single package, and passed to the calling routine without complications:

aBox := CreateBox(10, 20, 16, 59, "w+/n, w+/r")

And when I no longer needed the box and wished to restore the original screen:

DestroyBox( aBox )

Please compile DEMO1, to see the basic box functions.

CreateBox() and DestroyBox() are used to replace 10 lines of code, and the array aBox was used to replace 5 variables. Putting all the data into the array aBox and handling only the array, makes things much simpler.

Now that we have developed this technique, we could theoretically create a number functions that work together, like CreateBox() and DestroyBox(), and use the data contained in aBox. And in the file BOX.PRG, I have a group of sample functions that do just that:

 CreateBox()
 DestroyBox()
 BoldBox()
 MoveBox()

Another benefit of this technique, is that we can have multiple arrays that each correspond to separate boxes, and use them all at the same time.

For example, we could write a program with a couple of boxes:

 aBox1 := CreateBox( 05,  26,  20,  53,  "w+/n, w+/n" )
 aBox2 := CreateBox( 10,  20,  16,  59,  "w+/b, w+/b" )

To move the second box:

MoveBox( aBox2,  -08,  -18 )

Then we could give the second box a highlight:

BoldBox( aBox2, "w+/b, w+/b" )

Then to remove both boxes:

 DestroyBox(aBox2)
 DestroyBox(aBox1)

This example does some fairly complex things, and it does so, in only six lines of code. To run this example, compile the file DEMO2.PRG.

This programming technique has a name, it is called Object Oriented Programing (OOP).

According to OOP terminology the arrays aBox1 and aBox2 are objects, and the functions CreateBox, MoveBox, BoldBox, and DestroyBox are methods.

Objects are collections of related data, or in dBase terminology, arrays of related memvars. In our example, aBox1 and aBox2 are qualify as objects since they contain related data (the coordinates of the box, the original color, cursor position, cursor status, etc.).

In object oriented programming, several instances of an object can be created, and later destroyed when we are finished with them. In our example, aBox1 and aBox2, constitute two separate instances of box objects.

If you look at the example in DEMO3.PRG, you will see that the program creates an array of four box objects, and four separate instances of the box object are on the screen at once.

A methods is a special type of function. Methods are functions that are grouped together, and manipulate the same data objects. In the file BOX.PRG, you will see the code for four methods that use the box objects ( CreateBox, DestroyBox, BoldBox, MoveBox )

CreateBox is a special type of method called a constructor, because it creates a box object and initializes it.

DestroyBox is a special type of method called a destructor, because it destroys a box object and frees of the memory that the box object used.

Every time we call a method / function, we pass it the object we want the method to manipulate. In our example, we have two objects, aBox1 and aBox2. To move the first box, we called the method MoveBox() like this:

MoveBox( aBox1, 1, 1 )

And to bold the second box, we called the method BoldBox() like this:

BoldBox( aBox2, "w+/b,w+/n" )

The constructor CreateBox doesn’t need to be passed the object, because the constructor creates the object.

Now that you understand what an object is, you can create additional functions / methods that use the box object. And hopefully go on to create your own objects and methods.

Cynthia Allingham, 1991

/***
*
* BOX.PRG
*
* Written By: Cynthia Allingham 11/01/91
* Purpose: Displays exploding box on the screen
* Returns: Previous screen contents
*/
FUNC CreateBox (nTop, nLeft, nBottom, nRight, box_color)
local save_window:=savescreen(nTop, nLeft, nBottom, nRight)
local save_color:=setcolor(box_color)
local save_cursor:=setcursor()
local save_row:=row()
local save_column:=col()
@ nTop,nLeft,nBottom,nRight BOX 'ÚÄ¿³ÙÄÀ³ '
RETURN {nTop, nLeft, nBottom, nRight, save_window,;
 save_color, save_cursor, save_row, save_column}
/***
* Written By: Cynthia Allingham 11/01/91
* Purpose: destroys the box and restores old settings
*/
FUNC DestroyBox (aList)
restscreen(aList[1],aList[2],aList[3],aList[4],aList[5])
setcolor(aList[6])
setcursor(aList[7])
setpos(aList[8],aList[9])
aList:=nil
return nil
/***
* Written By: Cynthia Allingham 11/01/91
* Purpose: Changes the box border
*/
FUNC BoldBox (aList, cColor)
@ aList[1],aList[2],aList[3],aList[4];
 BOX 'ÛßÛÛÛÜÛÛ' color cColor
return nil
/***
* Written By: Cynthia Allingham 11/01/91
* Purpose: Redimensions the screen
*/
FUNC MoveBox (aList, nVert, nHorz)
local save_window:=savescreen(aList[1],aList[2],aList[3],aList[4])
dispbegin()
restscreen(aList[1],aList[2],aList[3],aList[4],aList[5])
aList[3] += nVert; aList[1]+=nVert
aList[4] += nHorz; aList[2]+=nHorz
aList[5]:=savescreen(aList[1],aList[2],aList[3],aList[4])
restscreen(aList[1],aList[2],aList[3],aList[4],save_window)
dispend()
return nil
* EOF BOX.PRG
/***
*
* DEMO1.PRG
*
* Written By: Cynthia Allingham 11/01/91
* Purpose: Simple program demonstrating the creation and
* destruction of a box object.
*/
local aBox
set procedure to box
@ 00,00,24,79 box 'ÚÄ¿³ÙÄÀ³°'
aBox:=CreateBox(10, 20, 16, 59, "w+/n, w+/r")
@22,19 say padc("Press any key to destroy the box",40)
inkey(10)
DestroyBox(aBox)
* EOF DEMO1.PRG
/***
*
* DEMO2.PRG
*
* Written By: Cynthia Allingham 11/01/91
* Purpose: Demonstates the use of two box objects
*/
local aBox1, aBox2
set procedure to box
@ 00,00,24,79 box 'ÚÄ¿³ÙÄÀ³°'
aBox1:=CreateBox(05, 26, 20, 53, "w+/n, w+/n")
message("Press any key to create a second box")
aBox2:=CreateBox(10, 20, 16, 59, "w+/b, w+/b")
message("Press any key to move the second box")
MoveBox(aBox2, -08, -18)
message ("Press any key to bold the second box")
BoldBox(aBox2, "w+/b, w+/b")
message("Press any key to destroy both boxes")
DestroyBox(aBox2)
DestroyBox(aBox1)
func message(ctext)
@22,19 say padc(ctext,40)
inkey(10)
* EOF DEMO2.PRG
/***
*
* DEMO3.PRG
*
* Written By: Cynthia Allingham 11/01/91
* Purpose: Demonstates the use of four box objects
*/
local aBox[4]
local cnt
set procedure to box
@ 00,00,24,79 box 'ÚÄ¿³ÙÄÀ³°'
aBox[1]:=CreateBox(05, 05, 09, 30, "w+/n, w+/n")
@ 06, 07 say "box #1"
aBox[2]:=CreateBox(18, 03, 22, 14, "w+/b, w+/b")
@ 20, 05 say "box #2"
aBox[3]:=CreateBox(20, 48, 22, 77, "w+/r, w+/r")
@ 21, 50 say "box #3"
aBox[4]:=CreateBox(02, 64, 12, 75, "w+/gr, w+/gr")
@ 03, 66 say "box #4"
for cnt:=1 to 12
 inkey(0.5)
 MoveBox(aBox[1], +1, 0)
 MoveBox(aBox[2], 0,+4)
 MoveBox(aBox[3], -1, 0)
 MoveBox(aBox[4], 0,-4)
next
inkey(10)
for cnt:=1 to 4
 DestroyBox(aBox[cnt])
next
* EOF DEMO3.PRG

C5 UI Commands & Functions

C5 User Interface Commands and Functions

Global Settings :

SET CENTURY :

Modify the date format to include or omit century digits

SET CENTURY on | OFF | <xlToggle>

SET COLOR* :

Define screen colors

SET COLOR | COLOUR TO [[<standard>]
    [,<enhanced>] [,<border>] [,<background>]
    [,<unselected>]] | (<cColorString>)

SET CONFIRM :

Toggle required exit key to terminate GETs

SET CONFIRM on | OFF | <xlToggle>

SET CONSOLE :

Toggle console display to the screen

SET CONSOLE ON | off | <xlToggle>

SET CURSOR :

Toggle the screen cursor on or off

SET CURSOR ON | off | <xlToggle>

SET DATE :

Set the date format for input and display

SET DATE FORMAT [TO] <cDateFormat>
SET DATE [TO] AMERICAN | ansi | british | french
    | german | italian | japan | usa

SET DECIMALS :

Set the number of decimal places displayed

SET DECIMALS TO [<nDecimals>]

SET DELIMITERS :

Toggle or define GET delimiters

SET DELIMITERS on | OFF | <xlToggle>
SET DELIMITERS TO [<cDelimiters> | DEFAULT]

SET DEVICE :

Direct @…SAYs to the screen or printer

SET DEVICE TO SCREEN | printer

SET EPOCH :

Control the interpretation of dates with no century digits

SET EPOCH TO <nYear>

SET FIXED :

Toggle fixing of the number of decimal digits displayed

SET FIXED on | OFF | <xlToggle>

SETBLINK() :

Toggle asterisk (*) interpretation in SET COLOR

SETBLINK([<lToggle>]) --> lCurrentSetting

SETCOLOR() :

Return the current colors and optionally set new colors

SETCOLOR([<cColorString>]) --> cColorString

SETCURSOR() :

Set the cursor shape

SETCURSOR([<nCursorShape>]) --> nCurrentSetting

SETMODE() :

Change display mode to specified number of rows and columns

SETMODE(<nRows>, <nCols>) --> lSuccess

SETPOS() :

Move the cursor to a new position

SETPOS(<nRow>, <nCol>) --> NIL

User Input :

CLEAR TYPEAHEAD :

Empty the keyboard buffer

CLEAR TYPEAHEAD

INKEY() :

Extract a character from the keyboard buffer

 
INKEY( [ <nSeconds> ] ) --> nInkeyCode

KEYBOARD :

Stuff a string into the keyboard buffer

KEYBOARD <cString>

LASTKEY() :

Return the INKEY() value of the last key in the buffer

LASTKEY() --> nInkeyCode

NEXTKEY() :

Read the pending key in the keyboard buffer

NEXTKEY() --> nInkeyCode

SET TYPEAHEAD :

Set the size of the keyboard buffer

SET TYPEAHEAD TO <nKeyboardSize>

Basic :

?/?? :

Display one or more values to the console

? | ?? [<exp list>]

@…BOX :

Draw a box on the screen

@ <nTop>, <nLeft>, <nBottom>, <nRight>
  BOX <cBoxString> [COLOR <cColorString>]

@…CLEAR :

Clear a rectangular region of the screen

@ <nTop>, <nLeft> [CLEAR
  [TO <nBottom>, <nRight>]]

@…SAY :

Display data at a specified screen or printer row and column

@ <nRow>, <nCol>
    [SAY <exp>
    [PICTURE <cSayPicture>]
    [COLOR <cColorString>]]
    GET <idVar>
    [PICTURE <cGetPicture>]
    [COLOR <cColorString>]
    [WHEN <lPreExpression>]
    [RANGE* <dnLower>, <dnUpper>] |
    [VALID <lPostExpression>]

@…TO :

Draw a single or double line box

@ <nTop>, <nLeft>
    TO <nBottom>, <nRight> [DOUBLE] [COLOR
    <cColorString>]

ACCEPT :

Place keyboard input into a memory variable

ACCEPT [<expPrompt>] TO <idVar>

INPUT :

Enter the result of an expression into a variable

INPUT [<expPrompt>] TO <idVar>

 

ALERT() :

Display a simple modal dialog box

ALERT( <cMessage>, [<aOptions>] ) --> nChoice

CLEAR SCREEN :

Clear the screen and home the cursor

CLEAR [SCREEN] | CLS

COL() :

Return the screen cursor column position

COL() --> nCol

COLORSELECT()

                Activate attribute in current color settings

   COLORSELECT(<nColorIndex>) --> NIL

DEVOUT() :

Write a value to the current device

DEVOUT(<exp>, [<cColorString>]) --> NIL

DEVOUTPICT() :

Write a value to the current device using a picture clause

DEVOUTPICT(<exp>, <cPicture>, [<cColorString>]) --> NIL

           DEVPOS() :

Move the cursor or printhead to a new position depending on the

current device

        DEVPOS(<nRow>, <nCol>) --> NIL

DISPBEGIN() :

Begin buffering screen output

DISPBEGIN() --> NIL

DISPBOX() :

Display a box on the screen

DISPBOX(<nTop>, <nLeft>, <nBottom>, <nRight>,
    [<cnBoxString>], [<cColorString>]) --> NIL

DISPCOUNT() :

Return the number of pending DISPEND() requests

DISPCOUNT() --> nDispCount

DISPEND() :

Display buffered screen updates

DISPEND() --> NIL

DISPOUT() :

Write a value to the display

DISPOUT(<exp>, [<cColorString>]) --> NIL

OUTERR() :

Write a list of values to the standard error device

OUTERR(<exp list>) --> NIL

OUTSTD() :

Write a list of values to the standard output device

OUTSTD(<exp list>) --> NIL

QOUT() :

Display a list of expressions to the console

QOUT([<exp list>]) --> NIL
QQOUT([<exp list>]) --> NIL

RESTORE SCREEN* :

Display a saved screen

RESTORE SCREEN [FROM <cScreen>]

RESTSCREEN() :

Display a saved screen region to a specified location

RESTSCREEN([<nTop>], [<nLeft>],
    [<nBottom>], [<nRight>], <cScreen>) --> NIL

ROW() :

Return the screen row position of the cursor

ROW() --> nRow

SAVE SCREEN* :

Save current screen to a buffer or variable

SAVE SCREEN [TO <idVar>]

SAVESCREEN() :

Save a screen region for later display

SAVESCREEN([<nTop>], [<nLeft>],
    [<nBottom>], [<nRight>]) --> cScreen

SCROLL() :

Scroll a screen region up or down

SCROLL([<nTop>], [<nLeft>],
     [<nBottom>], [<nRight>], [<nVert>] [<nHoriz>])
 --> NIL

TYPE :

Display or print the contents of a text file

TYPE <xcFile> [TO PRINTER] [TO FILE <xcOutFile>]

Advanced :

ACHOICE() :

Execute a pop-up menu

ACHOICE(<nTop>, <nLeft>, <nBottom>, <nRight>,
    <acMenuItems>,
    [<alSelectableItems> | <lSelectableItems>],
    [<cUserFunction>],
    [<nInitialItem>],
    [<nWindowRow>]) --> nPosition

BROWSE()* :

Browse records within a window

BROWSE([<nTop>], [<nLeft>],
    [<nBottom>], [<nRight>]) --> lSuccess

DBEDIT() :

Browse records in a table format

DBEDIT( [<nTop>], [<nLeft>],
    [<nBottom>], <nRight>],
    [<acColumns>],
    [<cUserFunction>],
    [<acColumnSayPictures> | <cColumnSayPicture>],
    [<acColumnHeaders> | <cColumnHeader>],
    [<acHeadingSeparators> | <cHeadingSeparator>],
    [<acColumnSeparators> | <cColumnSeparator>],
    [<acFootingSeparators> | <cFootingSeparator>],
    [<acColumnFootings> | <cColumnFooting>]) --> NIL

DISPLAY :

Display records to the console

DISPLAY <exp list>
    [TO PRINTER] [TO FILE <xcFile>]
    [<scope>] [WHILE <lCondition>]
    [FOR <lCondition>] [OFF]

LIST :

List records to the console

LIST <exp list>
    [TO PRINTER] [TO FILE <xcFile>]
    [<scope>] [WHILE <lCondition>]
    [FOR <lCondition>] [OFF]

LABEL FORM :

Display labels to the console

LABEL FORM <xcLabel>
    [TO PRINTER] [TO FILE <xcFile>] [NOCONSOLE]
    [<scope>] [WHILE <lCondition>] [FOR <lCondition>]
    [SAMPLE]

REPORT FORM :

Display a report to the console

REPORT FORM <xcReport>
    [TO PRINTER] [TO FILE <xcFile>] [NOCONSOLE]
    [<scope>] [WHILE <lCondition>] [FOR <lCondition>]
    [PLAIN | HEADING <cHeading>] [NOEJECT] [SUMMARY]

TEXT :

Display a literal block of text

TEXT [TO PRINTER] [TO FILE <xcFile>]
    <text>...
ENDTEXT

GET System :

Standard :

@…GET :

Create a new Get object and display it on the screen

@ <nRow>, <nCol>
    [SAY <exp>
    [PICTURE <cSayPicture>]
    [COLOR <cColorString>]]
    GET <idVar>
    [PICTURE <cGetPicture>]
    [COLOR <cColorString>]
    [WHEN <lPreExpression>]
    [RANGE* <dnLower>, <dnUpper>] |
    [VALID <lPostExpression>]

CLEAR GETS :

Release Get objects from the current GetList array

CLEAR GETS

READ :

Activate full-screen editing mode using Get objects

READ [SAVE]

READEXIT() :

Toggle Uparrow and Downarrow as READ exit keys

READEXIT([<lToggle>]) --> lCurrentState

READINSERT() :

Toggle the current insert mode for READ and MEMOEDIT()

READINSERT([<lToggle>]) --> lCurrentMode

READKEY()* :

Determine what key was used to terminate a READ

READKEY() --> nReadkeyCode

READMODAL() :

Activate a full-screen editing mode for a GetList

READMODAL(<aGetList>) --> NIL

READVAR() :

Return the current GET/MENU variable name

READVAR() --> cVarName

SET ESCAPE :

Toggle Esc as a READ exit key

SET ESCAPE ON | off | <xlToggle>

SET FORMAT :

Activate a format when READ is executed

SET FORMAT TO [<idProcedure>[.<ext>]]

SET INTENSITY :

Toggle enhanced display of GETs and PROMPTs

SET INTENSITY ON | off | <xlToggle>

SET SCOREBOARD :

Toggle the message display from READ or MEMOEDIT()

SET SCOREBOARD ON | off | <xlToggle>

UPDATED() :

Determine if any GET changed during a READ

UPDATED() --> lChange

Getsys.prg Functions :

GETACTIVE() :

Return the currently active Get object

GETACTIVE() --> objGet

GETAPPLYKEY() :

Apply a key to a Get object from within a Get reader

GETAPPLYKEY(<oGet>, <nKey>) --> NIL

GETDOSETKEY() :

Process SET KEY during Get editing

GETDOSETKEY(<oGet>) --> NIL

GETPOSTVALIDATE() :

Postvalidate the current Get object

GETPOSTVALIDATE(<oGet>) --> lSuccess

GETPREVALIDATE() :

Prevalidate a Get object

GETPREVALIDATE(<oGet>) --> lSuccess

GETREADER() :

Execute standard READ behavior for a Get object

GETREADER(<oGet>) --> NIL

READFORMAT() :

Return, and optionally set, the format file code block

READFORMAT([<bFormat>]) --> bCurrentFormat

READKILL() :

Return, and optionally set, the READ terminate flag

READKILL([<lKillRead>]) --> lCurrentSetting

READUPDATED() :

Return, and optionally set, whether a Get changed

READUPDATED([<lChanged>]) --> lCurrentSetting

GET Class :

Class Function :

GetNew() : Create a new Get object

Exported Instance Variables :

badDate : Indicates if the editing buffer contains an invalid date
block : Code block to associate Get with a variable
buffer : Character value that defines the editing buffer
cargo : User-definable variable
changed : Indicates whether the Get:buffer has changed
clear : Indicates whether the editing buffer should be cleared
col : Get column number
colorSpec : Display attributes string
decPos : Decimal point position within the editing buffer
exitState : Means by which the user exited the Get
hasFocus : Indicates whether or not the Get object has input focus
minus : Indicates whether or not a minus sign has been entered
name : Get variable name
original : Character string containing the original value of the Get
picture : PICTURE string
pos : Current cursor position within the editing buffer
postBlock : Code block to validate a newly entered value
preBlock : Code block to decide if editing is permitted
reader : Contains a block to affect READ behavior on a Get object
rejected : Indicates if last insert/overStrike character was rejected
row : Get row number
subscript : Information about array Get objects .
type : Get variable data type
typeOut : Indicates attempt to move the cursor out of editing buffer

Exported Methods :

State Change Methods :

assign() : Assigns the editing buffer contents to the Get variable
colorDisp() : Changes a Get object’s color and then redisplay it
display() : Displays the Get on the screen .
killFocus() : Takes input focus away from the Get object
reset() : Resets the internal state information of the Get
setFocus() : Gives input focus to the Get object
undo() : Sets the Get variable back to Get:original
unTransform() : Converts character value to its original data type
updateBuffer() : Updates the editing buffer and redisplays the Get
varGet() : Returns the current value of the Get variable
varPut() : Sets the Get variable to the passed value

Cursor Movement Methods :

end() : Moves the cursor to the rightmost position
home() : Moves the cursor to the leftmost position
left() : Moves the cursor left one character
right() : Moves the cursor right one character
toDecPos() : Moves the cursor to the immediate right of Get:decPos
wordLeft() : Moves the cursor left one word
wordRight() : Moves the cursor right one word

Editing Methods :

backspace() : Moves the cursor to the left and deletes one character
delete() : Deletes the character under the cursor
delEnd() : Deletes from current cursor position to the end of the Get
delLeft() : Deletes the character to the left of the cursor
delRight() : Deletes the character to the right of the cursor
delWordLeft() : Deletes the word to the left of the cursor
delWordRight() : Deletes the word to the right of the cursor

Text Entry Methods :

insert() : Inserts characters into the editing buffer
overStrike() : Overwrites characters in the editing buffer

Menu System :

@…PROMPT :

Paint a menu item and define a message

@ <nRow>, <nCol> PROMPT <cMenuItem>
     [MESSAGE <cExpression>]

MENU TO :

Execute a lightbar menu for defined PROMPTs

     MENU TO <idVar>

          MENUMODAL :

Activate a top bar menu

         MENUMODAL(<oTopBar>, <nSelection>, <nMsgRow>,
             <nMsgLeft>, <nMsgRight>, <cMsgColor>) --> MenuID

SET MESSAGE :

Set the @…PROMPT message line row

SET MESSAGE TO [<nRow> [CENTER | CENTRE]]

SET INTENSITY :

Toggle enhanced display of GETs and PROMPTs

SET INTENSITY ON | off | <xlToggle>

SET WRAP :

Toggle wrapping of the highlights in MENUs

SET WRAP on | OFF | <xlToggle>

Browse Classes :

TBrowse :

Provides objects for browsing table-oriented data.

Description :

A TBrowse object is a general purpose browsing mechanism for table-oriented data. TBrowse objects provide a sophisticated architecture for acquiring, formatting, and displaying data. Data retrieval and file positioning are performed via user-supplied code blocks, allowing a high degree of flexibility and interaction between the browsing mechanism and the underlying data source. The format of individual data items can be precisely controlled via the TBColumn data retrieval code blocks; overall display formatting and attributes can be controlled by sending appropriate messages to the TBrowse object.

A TBrowse object relies on one or more TBColumn objects. A TBColumn object contains the information necessary to define a single column of the browse table (see TBColumn class in this chapter).

During operation, a TBrowse object retrieves data by evaluating code blocks. The data is organized into rows and columns and displayed within a specified rectangular region of the screen. The TBrowse object maintains an internal browse cursor. The data item on which the browse cursor rests is displayed in a highlighted color. (The actual screen cursor is also positioned to the first character of this data item.)

Initially, the browse cursor is placed on the data item at the top left of the browse display. Messages can then be sent to the TBrowse object to navigate the displayed data, causing the browse cursor to move. These messages are normally sent in response to user keystrokes.

New data is automatically retrieved as required by navigation requests. When navigation proceeds past the edge of the visible rectangle, rows or columns beyond that edge are automatically brought into view. When new rows are brought into view, the underlying data source is repositioned by evaluating a code block.

Note: TBrowse objects do not clear the entire window before output during redisplay operations. Part of the window may still be cleared when data from the existing display is scrolled.

Class Functions :

TBrowseNew() :

Create a new TBrowse object

 TBrowseNew(<nTop>, <nLeft>, <nBottom>, <nRight>)
 --> objTBrowse

Returns a new TBrowse object with the specified coordinate settings. The TBrowse object is created with no columns and no code blocks for data positioning. These must be provided before the TBrowse object can be used.

TBrowseDB() :

Create a new TBrowse object for browsing a database file

 TBrowseDB(<nTop>, <nLeft>, <nBottom>, <nRight>)
 --> objTBrowse

Returns a new TBrowse object with the specified coordinate settings and default code blocks for data source positioning within database files. The default code blocks execute the GO TOP, GO BOTTOM, and SKIP operations.

Note that TBrowseDB() creates an object with no column objects. To make the TBrowse object usable, you must add a column for each field to be displayed

Exported Instance Variables:

autoLite : Logical value to control highlighting
cargo : User-definable variable
colCount : Number of browse columns
colorSpec : Color table for the TBrowse display
colPos : Current cursor column position
colSep : Column separator character
footSep : Footing separator character
freeze : Number of columns to freeze
goBottomBlock : Code block executed by TBrowse:goBottom()
goTopBlock : Code block executed by TBrowse:goTop()
headSep : Heading separator character
hitBottom : Indicates the end of available data
hitTop : Indicates the beginning of available data
leftVisible : Indicates position of leftmost unfrozen column in display
nBottom : Bottom row number for the TBrowse display
nLeft : Leftmost column for the TBrowse display
nRight : Rightmost column for the TBrowse display
nTop : Top row number for the TBrowse display
rightVisible : Indicates position of rightmost unfrozen column in display
rowCount : Number of visible data rows in the TBrowse display
rowPos : Current cursor row position
skipBlock : Code block used to reposition data source
stable : Indicates if the TBrowse object is stable

Exported Methods:

Cursor Movement Methods :

down() : Moves the cursor down one row
end() : Moves the cursor to the rightmost visible data column
goBottom() : Repositions the data source to the bottom of file
goTop() : Repositions the data source to the top of file
home() : Moves the cursor to the leftmost visible data column
left() : Moves the cursor left one column
pageDown() : Repositions the data source downward
pageUp() : Repositions the data source upward
panEnd() : Moves the cursor to the rightmost data column
panHome() : Moves the cursor to the leftmost visible data column
panLeft() : Pans left without changing the cursor position
panRight() : Pans right without changing the cursor position
right() : Moves the cursor right one column
up() : Moves the cursor up one row

Miscellaneous Methods :

addColumn() : Adds a TBColumn object to the TBrowse object
colorRect() : Alters the color of a rectangular group of cells
colWidth() : Returns the display width of a particular column
configure() : Reconfigures the internal settings of the TBrowse object
deHilite() : Dehighlights the current cell
delColumn() : Delete a column object from a browse
forceStable() : Performs a full stabilization .
getColumn() : Gets a specific TBColumn object
hilite() : Highlights the current cell
insColumn() : Insert a column object in a browse
invalidate() : Forces redraw during next stabilization
refreshAll() : Causes all data to be refreshed during the next stabilize
refreshCurrent() : Causes the current row to be refreshed on next stabilize
setColumn() : Replaces one TBColumn object with another
stabilize() : Performs incremental stabilization

TBColumn :

Provides the column objects TBrowse objects.

Description :

A TBColumn object is a simple object containing the information needed to fully define one data column of a TBrowse object (see the TBrowse reference in this chapter). TBColumn objects have no methods, only exported instance variables.

Class Function :

TBColumnNew() :

Create a new TBColumn object.

TBColumnNew(<cHeading>, <bBlock>) --> objTBColumn

Exported Instance Variables :

block : Code block to retrieve data for the column
cargo : User-definable variable
colorBlock : Code block that determines color of data items
colSep : Column separator character
defColor : Array of numeric indexes into the color table
footing : Column footing
footSep : Footing separator character
heading : Column heading
headSep : Heading separator character
width : Column display width

Example :

This example is a code fragment that creates a TBrowse object and adds some TBColumn objects to it:

USE Customer NEW
//
// Create a new TBrowse object
objBrowse := TBrowseDB(1, 1, 23, 79)
//
// Create some new TBColumn objects and
// add them to the TBrowse object
objBrowse:addColumn(TBColumnNew( "Customer", ;
                    {|| Customer->Name} ))
objBrowse:addColumn(TBColumnNew( "Address", ;
                    {|| Customer->Address} ))
objBrowse:addColumn(TBColumnNew( "City", ;
                    {|| Customer->City} ))
.
. <statements to actually browse the data>
.
CLOSE Customer

For a simple and working sample look at here.