| |
|
| Formats |
| 1.Define/Create: |
GRID ctl_id,@(col,ln,wth,ht)[,ctrlopt] |
| 2.Delete
Grid:
|
GRID
REMOVE ctl_id[,ERR=stmtref] |
| 3.Add
Row/Column: |
GRID ADD ctl_id,col,row[,ERR=stmtref] |
| 4.Load: |
GRID LOAD
ctl_id,col,row,contents$[,ERR=stmtref] |
| 5.Delete
Row/Column: |
GRID
DELETE ctl_id,col,row[,ERR=stmtref] |
| 6.Clear: |
GRID
CLEAR ctl_id,col,row[,width,height][,ERR=stmtref] |
| 7.Disable/Enable: |
GRID
{DISABLE | ENABLE}
ctl_id[,ERR=stmtref] |
| 8.Lock/Unlock: |
GRID
{LOCK | UNLOCK}
ctl_id,col,row[,width,height][,ERR=stmtref] |
| 9.Set
Focus:
|
GRID GOTO
ctl_id[,ERR=stmtref] |
| 10.Focus
on Cell Address: |
GRID GOTO
ctl_id,col,row[,ERR=stmtref] |
| 11.Read
First Cell: |
GRID READ
ctl_id,col,row,var$,eom$[,ERR=stmtref]
|
| 12.Read
Next:
|
GRID READ
NEXT ctl_id,col,row,var$,eom$[,ERR=stmtref]
|
| 13.Select
Range:
|
GRID
SELECT ctl_id,col,row[,width,height][,ERR=stmtref]
|
| 14.Select
Read: |
GRID
SELECT READ ctl_id,col,row[,ERR=stmtref]
|
| 15.Select
Read Next: |
GRID
SELECT READ NEXT ctl_id,col,row[,ERR=stmtref]
|
| 16.Select
Reset: |
GRID
SELECT RESET ctl_id[,ERR=stmtref]
|
| 17.Find
or Retrieve: |
GRID FIND
ctl_id,col,row,var$[,ERR=stmtref]
|
| 18.Write
Setting: |
GRID
WRITE ctl_id,col,row,contents$[,ERR=stmtref]
|
| 19.Set
Focus:
|
GRID
SET_FOCUS ctl_id,alt_ctl[,ERR=stmtref]
|
| 20.Focus
Notification: |
GRID AUTO
ctl_id[,ERR=stmtref]
|
| 21.Hide/Show: |
GRID
{HIDE | SHOW} ctl_id[,ERR=stmtref]
|
Where:
@(col,ln,
wth,ht ) |
Position
and size of the grid region. Numeric expressions.
Column and
line coordinates for top left corner, width in
number of columns and height in number of lines.
Note that width and height are for the total
area. |
| alt_ctl
|
Alternate
CTL value that will be generated when the grid
receives focus. |
| ctl_id |
Unique
logical identifier for the grid (any integer -32000
to +32000). Avoid integers that conflict with
keyboard definitions (e.g., 4 cancels CTL=4 for
the F4 key) or Negative CTL
Definitions. Use this value
with the apostrophe operator to access various Grid
Properties. |
| col,row |
Column
and row refer to cell location / coordinates.
Numeric expressions. |
| contents$
|
Value(s)
to be written to the cell(s) or settings. String
expression(s). |
| ctrlopt |
Control
options. Supported options for GRID
include:
| ERR=stmtref
|
Error transfer |
| FMT=def$
|
Format definition, see
below. |
| FNT="font,size[,attr]"
|
Font name, size, optional
properties Refer to the 'FONT' Mnemonic for details. |
| MSG=text$
|
Message line |
| MNU=ctl
|
CTL value associated with
right-click menu event. |
| OPT=char$
|
Single character option. See
GRID OPT= Settings |
| SEP=char$
|
Delimiter character. Hex or
ASCII string value; e.g.,
GRID
7050,@(5,5,35,15),SEP=":"
...
GRID 7050,@(5,5,35,15),SEP=$3A$ ...
GRID
7050,@(5,5,35,15),SEP=MY_SEP$ ...
The
default delimiter is the SEP
character (e.g., $8A$).
|
| TIP=text$ |
Mouse pointer message. To
change the colour, refer to the 'TC'= System
Parameter. |
|
| eom$ |
EOM
(End-of-Message) character sequence. Hex string
expression (e.g.,
$0D$ for the Enter key). |
| var$ |
String
variable. Receives cell values returned for FIND
and READ. |
| stmtref |
Program
line number or statement label to which to
transfer control. |
|
| |
|
| Description |
Use the GRID
directive to create a grid or table of cells in columns
and rows; i.e., a spreadsheet input format. The GRID
control object is a two-dimensional
array of multi_line input fields (default), check_boxes,
buttons, drop_boxes or any combination
of these control objects. Each cell can be of a different
type.
For some formats of the GRID
directive (e.g., GOTO and FIND),
both column and row coordinates are required (to
act as pointers to a particular cell). For other formats,
one or both of the values can be 0 (zero). The following chart shows how
ProvideX interprets the column and row values.
| Column, Row
Values |
How
ProvideX Interprets These |
| col = 1, row
= 1 |
The
topmost cell is 1,1 |
| col = 0, row
= 0 |
All
columns and rows respectively; i.e., GRID DELETE 100,0,0
deletes the entire grid whose control ID is
100.
|
col = num, row
= 0
(col <> 0, row = 0 or
omitted) |
Entire
column; i.e., GRID DELETE 100,3,0 deletes
column 3 of the grid whose control ID is 100. Note that the GOTO
and FIND formats of the grid
directive require both column and line
coordinates. You cannot omit the row in those
formats.
|
col = 0, row
= num
(col = 0 or omitted, row
<> 0) |
Entire
row; i.e., GRID DELETE 100,0,2 deletes row 2
of the grid whose control ID is 100. Note that the GOTO
and FIND formats of the grid
directive require both column and line
coordinates. You cannot omit the column in
those formats.
|
col =num, row=num
(col and row are <>
0) |
Column
and row; i.e., GRID DELETE 100,3,2
deletes both an entire column
(column 3) and an entire row (row 2) of the
grid whose control ID is 100.
GRID GOTO
100,3,2 sets focus on the cell located in
column 3, row 2.
|
| col and/or row
= -1 |
By
default, there are also column and row
headers you can gain access to using column
and/or row = -1. You cannot include these
headers in any range specifications. |
|
|
|
| *Note* |
Referencing
a setting or value using a row number of zero
(0) and a non-zero column number references the
column DEFAULT values. Columns (and only columns) can
have a default setting which will apply to any cell
within the column that does not have the corresponding
setting/value established for the cell itself. Only
columns can have default settings, not rows. Setting the column
number to zero with a non-zero row number will
set the values for all cells in the row. |
|
|
| |
GRID OPT= Settings
The single-character
parameters for OPT=char$ are
listed below:
| "A" |
Auto
signal is on. ProvideX returns a
signal on changes. |
| "B" |
Borderless
Grid has no border or frame. |
| "D" |
Disabled.
Grid is grayed out and is not accessible
to the user. |
| "H" |
Hide.
Grid is not displayed but is accessible
programmatically. |
| "s" |
Scroll.
Grid can scroll within a
resizable/scrollable dialogue box. |
| "T" |
Strip
Trailing. Strip trailing spaces. |
| "X" |
Signal
on exit. Signal when focus exits from
the grid. |
| "Z" |
Cursor
changes to resize pointer if within 4 pixels
from the edge of the control. |
|
| |
Format Definition
The FMT=def$
option allows you to define the format for cells in the
grid. In the following syntax, the round and square
brackets are part of the format:
FMT=[col_title](cell_type:col_name)
Alignment Width
Where:
| Alignment |
Alignment
character: L (left), C
(centered), R (right). Default:
L. |
| cell_type |
Cell
type for the column. The default cell type is
"Normal". See Cell Types for a
list of available cell types. |
| col_name |
A
text string containing the logical name of
column. If no name is provided, the column title
can be used to reference the column |
| col_title |
Text
string appearing as the title in the top row of
the grid. |
| Width |
Width
of the column in standard text character columns. |
|
| |
Example:
"[Client
ID](Multi_line:CST_ID$)L10
[Name](Normal:CST_NAME$)L10"
Cell
Types
The following cell types
can be assigned using the FMT= option in
the GRID directive or via the 'Celltype$
grid object property:
| Cell type |
Description |
| "Button" |
Cell
works like a button if clicked. Cell can be
changed if not locked (on double click). Set 'Lock
property to 1 to achieve standard button
behaviour for cell. |
| "CheckBox" |
Check
box with no 3D effect ('Value=0 or
1,'Text=label). |
| "CheckBoxRaised" |
3D
check box that looks raised. |
| "CheckBoxRecessed" |
3D
check box that looks recessed. |
| "CheckMark" |
Check
box that uses a check mark. |
| "CheckMarkRaised" |
Raised
check box that uses a check mark |
| "CheckMarkRecessed" |
Recessed
check box that uses a check mark. |
| "DropBox" |
Text
cell that, when editing, allows user to make
selection from a drop down list. The drop list is
loaded from the 'Text$ property. |
| "DropBoxHideBtn" |
Same
as "DropBox", but the drop down button
is shown only when focus is on the cell. |
| "Ellipsis" |
Normal
text cell that will show "
if text
exceeds displayable area. Ctrl - Enter can
be used to force a new line in the cell (inserts
$0D0A$ into cell value). |
| "EllipsisDrop" |
Same
as "Ellipsis", but forces the cell to
drop vertically only during an edit. Ctrl
- Enter can be used to force a new line
in the cell (inserts $0D0A$ into cell value). |
| "Lookup" |
Small
button at the right side of cell used to invoke
lookup - button image is defined via the
cells 'Bitmap property. If
no image is given, button shows three dots. |
| "LookupHideBtn" |
Same
as "Lookup", but indicates that the
button is hidden when the cell is not selected. |
| "Multi_line" |
Normal
text cell that can contain multiple lines of
text.
* Note* Ctrl - Enter can
be used to force new line (value $0D0A$). |
| "Normal" |
Normal
text cell containing one line of data. |
| "Query" |
Same
as "Lookup", but user is unable to edit
the cell. |
| "QueryHideBtn" |
Same
as "LookupHideBtn", but user is unable
to edit the cell. |
| "SingleLine" |
Normal
text cell that allows for a single line of entry,
expanding the cell horizontally according to the
overlap rules. It does not allow vertical
expansion, like a multiline. |
"UseTextNormal"
"UseTextSingleLine"
"UseTextEllipsis" |
Similar
to "Normal","SingleLine"
and"Ellipsis" respectively, except
value of 'Text$ property is
displayed. During input and editing, the'Value$
property is presented and entered into the cell. |
| "VarDropBox" |
Text
cell that, when editing, allows user to make a
selection from a dropdown list or enter any other
value. Drop list selections are loaded using 'Text$
property. |
| "VarDropBoxHideBtn" |
Same
as "VarDropBox", but the drop down
button is shown only when focus is on the cell. |
|
| |
Grid
Properties The Apostrophe Operator can be used with
the unique logical identifier (ctl_id) to
dynamically read and alter a wide variety of control
attributes (properties) directly from the programming
language. Most cell attributes are only accessible
through the implementation of properties. For example,
drag and drop functionality utilizes the 'DraggedColumn, 'DraggedRow,
'DroppedOnColumn, and 'DroppedOnRow
properties.
The complete list of
properties available for manipulating a grid are
described in Control Object Properties,
|
|
|
| *Note* |
In order to
access many grid properties, cell(s) must be identified
first using the 'Column and 'Row
properties. See Grid Property Access. |
|
|
| Format
1 |
Create Grid
GRID ctl_id,@(col,ln,wth,ht)[,ctrlopt]
Use this format to create
your grid. The value in ctl_id is a unique
identifier for your grid. This value is used to generate
a CTL value whenever the grid is selected and changed.
|
| |
|
| Format
2 |
Delete Grid
GRID REMOVE ctl_id[,ERR=stmtref]
Use this format to delete
an entire grid.
|
| |
|
| Format
3 |
Add Row/Column
GRID ADD ctl_id,col,row[,ERR=stmtref]
Use the GRID ADD
format to add a row or column of blank cells to your
grid. At least one of the col,row values must be
other than 0 (zero).
|
| |
|
| Format
4 |
Load
GRID LOAD ctl_id,col,row,contents$[,ERR=stmtref]
Use GRID LOAD
to load contents$ into the grid from a string
variable or expression. You must include both the column
and the row for the address at which the load is to
start. If column and row are both 0 (zero) then the grid
is cleared first.
ProvideX can load a number
of columns and rows of data at a time. Column and row
separators are mandatory. Set the column
separator using the SEP= option. Set
your row separator by including it as the last character
in your data string. (ProvideX treats the last character
in the string as your row separator.)
Adding a New
(Bottom) Row: Use row=0 to add a
new row to the bottom of a grid; i.e., GRID LOAD ctl,1,0,data$+ESC ! (Using
ESCas the row delimiter)
|
| |
|
| Format
5 |
Delete Col/Row
GRID DELETE ctl_id,col,row[,ERR=stmtref]
Use the GRID
DELETE format to delete a column or row from
your grid. You can identify a column to delete, a row to
delete, or both.
Reminder: If
you use zero (0) as your value for both
column and row, ProvideX interprets that as all columns and rows,
respectively and will delete the entire
grid.
|
| |
|
| Format
6 |
Clear
GRID CLEAR
ctl_id,col,row[,width,height][,ERR=stmtref]
Use the GRID CLEAR
format to clear or reset the contents of a range
of cells to the default (empty). You can clear a column
or a row or both.
Reminder: If
you use zero (0) as your value for both
column and row, ProvideX interprets that as all columns and rows,
respectively and will clear the entire
grid.
|
| |
|
| Format
7 |
Disable/Enable
GRID
{DISABLE | ENABLE} ctl_id[,ERR=stmtref]
Use the GRID
DISABLE format to disable a grid so that it will
be visible but inaccessible
to users. To reactivate it, use GRID ENABLE.
|
| |
|
| Format
8 |
Lock/Unlock
GRID
{LOCK | UNLOCK} ctl_id,col,row[,width,height][,ERR=stmtref]
Use the GRID LOCK
format to allow/deny access to a range of cells in the
grid. The user cannot change the cell's value, but if the
cell is a button control the user can still click on it.
Use the GRID UNLOCK format to release
the locked range of cells for other processes.
Reminder: If
you use zero (0) as your value for both
column and row, ProvideX interprets that as all
columns and rows, respectively and will lock/unlock
the entire grid. You can also use a grid control object's
properties to lock or unlock cells (by setting
the 'Row, 'Column and 'Lock properties). Set your 'Lock
value to 1 (lock) or 0 (zero to unlock).
The default background
colour for locked cells is LIGHT GRAY (standard button face colour). Use
the 'BackColour property to override
this. See Grid Properties.
|
| |
|
| Format
9 |
Set Focus
GRID GOTO
ctl_id[,ERR=stmtref]
Use this format of the GRID
GOTO directive to set the focus on the first
cell of your grid, ready for the user's next action.
|
| |
|
| Format
10 |
Focus on Cell Address
GRID GOTO ctl_id,col,row[,ERR=stmtref]
Use this format of the GRID
GOTO directive to go to a specific cell address
(other than the first cell) and set the focus on that
cell, ready for the user's next action. You must include both column and
row coordinates in this format of the directive (not zero
values).
|
| |
|
| Format
11 |
Read First Cell
GRID READ ctl_id,col,row,var$,eom$[,ERR=stmtref]
Use var$ in the GRID
READ format to receive the modified cell address
and value of the first selected cell. If the
cell doesn't exist, an Error #2: END-OF-FILE on read or
File full on write. If there is more to read, the CTL
event is re-posted. The
eom$ string tells you which input sequence ended the
message (e.g., $0D$ for the Enter key).
The GRID READ
directive must include both column and row addresses.
ProvideX returns a queue of cells that have been changed
and generates an additional CTL event after a read to
ensure that no events are lost. There can be a problem
due to potential race conditions when the host is unable
to keep up with the user input. To circumvent this,
ProvideX returns Error #2: END-OF-FILE on read or File
full on write if the queue is empty
|
|
|
| *Note* |
Under
NOMADS, the read is automatic and should not be
done by your application. The data read is placed in the
standard input variable with control_name.row and
control_name.col containing the associated cell
information. |
|
|
| |
|
| Format
12 |
Read Next
GRID READ NEXT
ctl_id,col,row,var$,eom$[,ERR=stmtref]
Use the string var$
in the GRID READ NEXT format to receive
the modified cell address and value of the next (not
first) selected cell. If this cell doesn't exist,
ProvideX returns an Error #2: END-OF-FILE on read or File
full on write. If there is more to read, no CTL event is
re-posted. The CTL value is posted when
another cell is changed. The eom$ string tells you what
input sequence ended the message (e.g., $0D$ for the Enter
key)
|
| |
|
| Formats
13, 14, 15, 16 |
Select Read/Reset Use the following formats to select
ranges of cells to READ or to RESET
(to remove cells from the SELECT
state). GRID SELECT can be used to
control cell selection. (When you SELECT
a range of cells, the given cells are added to the list
of selected cells.) To determine which cells are
selected: use GRID SELECT READ to obtain
the first selected cell, then use GRID SELECT
READ NEXT to get subsequent cells.
Reminder: If
you use a zero (0) in both col
and row, ProvideX interprets that to mean
"all cells" and
will select the entire grid.
GRID SELECT ctl_id,col,row[,width,height][,ERR=stmtref]
Select Range.
This format selects a
range of cells from your grid. GRID SELECT READ ctl_id,col,row[,ERR=stmtref]
Select Read. Use
this to read the first selected cell. If the
cell doesn't exist, ProvideX returns Error #11: Record not found or
Duplicate key on write.
GRID SELECT
READ NEXT ctl_id,col,row[,ERR=stmtref]
Select Read
Next. Use this format to read the next
(not the first) selected cell. When ProvideX encounters a
GRID SELECT READ NEXT after the last
selected cell is returned, it reports Error #2: END-OF-FILE on read or
File full on write.
GRID SELECT
RESET ctl_id[,ERR=stmtref]
Select Reset. This
format removes all cells from the SELECT
state. There is no way to remove cells from the selected
state individually.
|
| |
|
| Format
17 |
Find or Retrieve
GRID FIND ctl_id,col,row,var$[,ERR=stmtref]
Use a string var$
in the GRID FIND format to return the
value for a specific cell.
Retrieve
range of cells
| GRID ctl_id,
0 ,row, var$[,ERR=stmtref]
|
(retrieve all cells in row) |
| GRID ctl_id,
col, 0 ,
var$[,ERR=stmtref] |
(retrieve all cells in
column) |
| GRID ctl_id,
0 , 0 ,
var$[,ERR=stmtref] |
(retrieve all cells in grid) |
Specifying a col
or row of zero (0) causes
PxPlus to return all columns/rows of the grid.
Grid range retrieval
is a +PxPlus
Exclusive
|
| |
|
| Format
18 |
Write Setting
GRID WRITE ctl_id,col,row,contents$[,ERR=stmtref]
Use GRID WRITE to
update your grid by writing settings to specified cells. Reminder:
If zero (0) is used for both col
and row, then the value specified in contents$
will be written to each cell in the grid.
|
| |
|
| Format
19 |
Set Focus
GRID SET_FOCUS
ctl_id,alt_ctl[,ERR=stmtref]
Use the GRID
SET_FOCUS format to have ProvideX return CTL
values when focus changes to an address in the grid.
|
| |
|
| Format
20 |
Focus Notification
GRID AUTO
ctl_id[,ERR=stmtref]
Use this format to have
ProvideX return a CTL value whenever focus changes occur
within your grid. You can use the values in your
applications to track a users' selections.
|
| |
|
| Format
21 |
Hide/Show
GRID
{HIDE | SHOW} ctl_id[,ERR=stmtref]
With the GRID HIDE
format, the grid remains active, but is not displayed. It
is still accessible programmatically. Use the SHOW
format to restore the display and user access.
|
| |
|
| Example |
The example
on the following page demonstrates how you can use a
combination of GRID
directives and GRID control object
properties to perform various functions (formatting, loading, retrieving,
etc.).
0010 ! GRIDDEMO
- Grid demo program
0020 BEGIN ;
0020:PRINT
'CS',"Grid Demonstration"
0030 GRID
10,@(3,3,70,15)
0040 GRID
LOAD 10,0,0,""
0050 FOR R=1
TO 10
0060 LET
R$=""
0070 FOR C=1
TO 10
0080 LET
R$+=STR(C*R)+SEP
0090 NEXT
0100 GRID
LOAD 10,1,0,R$
0110 NEXT
0120 LET
X=10
0130 FOR I=1
TO 10;
0130:LET
X'ROW=-1,X'COLUMN=I;
0130:LET
X'VALUE$="Col "+STR(I);
0130:NEXT
0140 FOR I=1
TO 10;
0140:LET
X'ROW=I,X'COLUMN=-1;
0140:LET
X'VALUE$="Row "+STR(I);
0140:NEXT
0150 LET
X'COLUMN=-1,X'COLUMNWIDTH=6
0160 LET
X'COLUMN=2,X'ROW=0,X'LOCK=1
0170 LET
X'COLUMN=3,X'ROW=0,X'COLUMNWIDTH=7,X'CELLTYPE$="Button",X'LOCK=1
0180 LET
X'COLUMN=4,X'ROW=0,X'COLUMNWIDTH=7,X'CELLTYPE$="CheckMarkRecessed"
0190 LET
X'COLUMN=5,X'ROW=0,X'COLUMNWIDTH=7,X'CELLTYPE$="DropBox",
0190:X'TEXT$="car/pig/dog/"
0200 LET
X'COLUMN=6,X'ROW=0,X'COLUMNWIDTH=7,X'CELLTYPE$="DropBoxHideBtn",
0200:X'TEXT$="car/pig/dog/"
0210 LET
X'COLUMN=7,X'ROW=0,X'COLUMNWIDTH=7,X'BITMAP$="!bug"
0220 LET
X'COLUMN=8,X'ROW=0,X'ALIGN$="C"
0230 LET
X'COLUMN=9,X'ROW=0,X'ALIGN$="R"
0240 LET
X'COLUMN=0,X'ROW=2,X'BACKCOLOUR$="LIGHT
CYAN"
0250 LET
X'COLUMN=0,X'ROW=3,X'BACKCOLOUR$="LIGHT
YELLOW"
0260 LET
X'ROW=8;
0260:FOR I=1
TO 10;
0260:LET
X'COLUMN=I;
0260:LET
X'BACKCOLOUR$="RGB:"+STR(RND(200)+55)+"
"+STR(RND(200)+55)+
0260:"
"+STR(RND(200)+55);
0260:NEXT
0270 LET
X'ROW=9;
0270:FOR I=1
TO 10;
0270:LET
X'COLUMN=I;
0270:LET
X'TEXTCOLOUR$="RGB:"+STR(RND(200)+55)+"
"+STR(RND(200)+55)+
0270:"
"+STR(RND(200)+55);
0270:NEXT
0280 FOR I=1
TO 10;
0280:LET
X'COLUMN=I,X'ROW=I,X'FONT$="Arial,1,BI";
0280:NEXT
0290 INPUT
X$;
0290:IF
CTL=4
0290:THEN
STOP
0300 IF
CTL<>10
0300:THEN
PRINT "Recv'd CTL=",CTL;
0300:GOTO
0290
0310 GRID
READ 10,C,R,ZZ$,E$
0320 PRINT
@(0,20),'CL',"Col=",C,"
Row=",R," Dta=",ZZ$,"
Eom=$",HTA(E$),"$",
0330 GOTO
0290
|