SELECT
|
Syntax: |
SELECT([<WAIT|NOWAIT>,<Exit
Macro>,<Split-Windowcall Handle>],
<Name of Index File>, <Number of Key>, <Equal>,
<Header> ,<Column Titles>, <Color Column Titles>,
<Colors of Column Titles> [,<@Image
Separator>, <Image Display>] [,<#Mark
Field>, <Mark Color>],
<Fields>) <Fields> = ~<Fieldstring> |
<Select Field>, <Field Width> [,<Select
Field>, <Field Width>]...
|
||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||
|
Meaning: |
SELECT opens a window that shows the data records
of an Index File. WINDOWPOS defines the position of the SELECT Window. Note: In contrast to other Index File instructions it is not possible to
specify a <STRING-EXPRESSION> instead of a <INDEX FILE NAME> with
this function. SELECT is inserted on the mask like a mask
field if the following three conditions are fulfilled: 1. The parameter NOWAIT is specified. 2. The title is the empty string
"". 3. DISABLE
WINDOW_BORDER is set. Or if the following two conditions are
fulfilled: 1. The parameter NOWAIT is specified. 2. The variable EBUS_CHILDWINDOW is not 0. In this case the SELECT can be called like
the other fields by the keys <→|>, <↓>, etc. In the <Exit Macro> the variable EBUS_DATA contains the return code of the SELECT. With NOWAIT the SELECT is started and the
function is terminated immediately and returns the handle of the SELECT. With
the instruction CLOSE_SELECT(<Handle>) a SELECT opened with NOWAIT can be closed. WAIT the SELECT is started hierarchically:
The function is only terminated when the SELECT has been terminated. The Macro <Exit Macro> is executed
after the SELECT has been terminated, either by closing the window, by ESC or
by the instructions ENDSELECT or QUITSELECT. If WAIT or NOWAIT is specified, an <Exit
Macro> must be specified as well. With NOWAIT the variable EBUS_DATA contains in the <Exit Macro> the return code of the
SELECT. If the SELECT is to be displayed in the split
window, NOWAIT has to be specified and <Split-Windowcall Handle> must
contain the handle of the split window. If
the SELECT be inserted on a WINDOWCALL mask
like a mask field, EBUS_CHILDWINDOW
must be <> 0 and <Split-Windowcall Handle> must contain the
handle of a WINDOWCALL mask. If the parameters [WAIT | NOWAIT,<Exit
Macro>,<Split-Handle>] are missing, then this is equivalent to WAIT. With NOWAIT all switches and ON <Event> Macros are saved when the SELECT is started and each time it is left.
When the SELECT is activated again the last state of the switches and the ON
<Event> Macros is restored. After each ON SELECT(<Key>) MACRO that is executed
in the SELECT the ON <Event> Macros are saved again. <Column
Titles> can be defined optionally. They appear in the first line of the
SELECT Window in the <Color Column Titles>. If the first character of
the <Column Titles> is the semi-colon ';', it is assumed that
<Column Titles> contains separated by semi-colon the titles of the
columns. In <Colors of Column Titles> a separate
color can be defined for each column title separated by semi-colons. For each
color <Foreground Color , Background Color> must be specified in square
brackets. As fore- and background color the number of an RGB color or a negative number must be specified. With a negative number
the respective color is not set and the standard fore- or background color
applies. Checkboxes can be displayed in the SELECT. In
the SELECTA checkboxes are specified by a separator. There are no separators
with the SELECT. Here the separator for checkboxes is defined by the variable
EBUS_SELECT_CHECKBOXCHAR$. The separator must be
specified as first character in the column title. In this way all fields of
the column are shown as checkbox. It is not possible to mark separate fields
of a column as checkbox. The character EBUS_SELECT_COMBOBOXCHAR$ marks comboboxes. It can only be specified in the <Column
Headers> and applies to the whole column. If a field of the column is
edited with SELEDIT$ a
combobox appears where an item can be selected. The elements of the combobox
have to be added behind the column header (separated by the combobox
separator). Sample:
The combobox separator is # COLUMN_HEADER$ = ";No;#DayOfWeek#Monday#Wednesday#Friday#Sunday;Date;..." The 2nd column has the header
"DayOfWeek". If a field of the 2nd column is edited by SELEDIT$, a combobox with the following items appears: Monday Wednesday Friday
Sunday Note: EBUS_SELECT_COMBOBOXCHAR$ shall
only be applied to alphanumeric fields. If the header line is clicked with the mouse,
the ON MOUSE Macro is executed. If the field titles are separated by ';', EBUS_SELECT_FIELD contains the number of the clicked column, otherwise EBUS_SELECT_FIELD = 0. The SELECT can also display images. For this
purpose an @<Image Separator> must be specified. The character @ marks
the image separator. If a field begins with this character, the text after
this character is interpreted as image and the image is displayed instead of
the text. <Image Display> defines how the image
is to be shown:
A field of the Index File can optionally be
defined as <Mark Field>. Therefore the
character '#' must be inserted before the field name. The field must be an
alphanumeric field. Numeric fields and date fields are not allowed. The Mark
field does not appear in the display. If this is requested, the field name
must once again be defined as <Select Field> afterwards. If a Mark
Field is specified, it is checked with every data record displayed whether
the Mark Field only consists of blanks. If this is the case, the line is
considered unselected and displayed in its default mode. If the field
contains any other character than blanks, the line is displayed in the
<Mark Color>. An RGB color must be specified
as mark color. Beside the Index File variables even constant
strings, alphanumeric auxiliary variables and alphanumeric Index File
variables from other Index Files can be displayed as <Select Field>. In
order to distinguish these fields from the fields of the Index File defined
in SELECT the character '$' must be put before these variables. This does not
apply to constant strings since they are clearly defined by the character
". The characters ', ' and '; ' may not appear in constant strings. Only
alphanumeric variables (no numeric or date variables) can be specified.
Auxiliary variables and variables of other Index Files can be manipulated
just like the variables of the Index File in the ON SELECT Macro. For each field an won color can be defined in
the ON SELECT Macro with the help of the variable EBUS_SELECT_COLOR$. SELECT can be called with any number of arguments.
With each field name the <Field Width> to be displayed can be
specified. The <Field Width> does not have to be defined. If it is
missing, the field is displayed in the length defined with the file
specification. When the field name is specified it is also possible to
specify the file name before the field name. If <Field Width> = n, the
left n characters are displayed with alphanumeric fields and date fields and
the right n numbers are displayed with numeric fields. Instead of the arguments <Select
Field>, <Field Width> [,<Select
Field>, <Field Width>]... a string expression ~<Fieldstring> can be
specified. <Fieldstring> contains the fields to be displayed in the
format <Select Field>, <Field Width> [,<Select Field>, <Field Width>]... . After the SELECT function has been called a START or STARTS is executed first in the Index File with the key = <Number of
Key>. If the START command returns an error, the SELECT function is left
with the return code –1. By READ-NEXT and READS-NEXT as many data records are read as needed to fill the window. If
<Equal> is bigger than 0, the content of the key fields of the key
<Key Number> is saved before the START instruction is executed. After
every successful read access (READ-NEXT and READS-NEXT) it is checked whether
the left <Equal> characters of the key of the just read record are
identical with the characters of the saved key. If this is not the case, the
last file access is treated like the end of file. With ENABLE SELECT_ASCENDING the data records are displayed in ascending
order, with DISABLE SELECT_ASCENDING they are displayed in descending order. When first letters (alphanumeric key field)
or ending numbers (numeric key field) are entered with ENABLE SELECT_SEARCH the highlight bar is automatically set on the data
record whose key begins or ends with the entered characters. If no such data
record exists, the highlight bar is positioned on the data record with the
next biggest key. The ON
SELECT(PGDN) Macro is executed and the entered characters are displayed in the
message line. If parameter <Equal> > 0, the search characters refer
to the position <Equal> + 1, which means that the search string
consists of the first <Equal> characters of the Select key and the
entered characters. The switch has no effect while no ON
SELECT(KEY) Macro is active. The ON SELECT(MOUSE) Macro is executed in SELECT if the left mouse button has been pressed
and one or more of the keys SHIFT, Alt or Ctrl are being pressed at the same
time. With the keys <↓>, <↑>,
<PGDN> and <PGUP> it can be scrolled forwards and backwards (in
the sorting order of the specified key). If <Equal> = 0 the whole file
can be scrolled, otherwise only in the section of the file defined by
<Equal>. With <RETURN> a data record can be
selected. In this case the selected record can be read by the primary key
(and in this way becomes the current record in the Index File) and the
function SELECT is left with return code = 1. The same applies when a data
record is selected with the left mouse button. With DISABLE SELECT_DOUBLECLICK a data record can be selected with a single mouse
click or with the left mouse button; ENABLE SELECT_DOUBLECLICK requires a double-click or a single mouse click
on the currently selected line. <Esc> terminates SELECT with return
code 0. If SELECT is terminated with return code 0
(no data record has been selected), the data record is, after the SELECT
function has been left, again read by the primary key that had been valid
before the SELECT was called. Within the function SELECT program execution
temporarily switches to NOREADLOCK. In this way even locked
data records can be read and displayed in the multi-user mode. If the
operation system or network does not allow the reading of data records, a
line of '?' is displayed instead of
the data. The variable EBUS_SELECT_FIXCOLUMNS specifies which columns of the SELECT are fixed. Fixed columns remain
visible even if the horizontal scroll bar of the SELECT is shifted to the
right. SELECT returns the following values: -1: No data records found -2:
SELECT can be called into a split window only with NOWAIT. 1: The user has selected a data record with
<RETURN> . 0: The user has not selected a data record,
SELECT has been left with <Esc>. |
||||||||||||||||||||||||||||||||||
|
Parameter: |
|
||||||||||||||||||||||||||||||||||
|
Sample: |
Sample
1: The Index File is read in the sorting order of the secondary key 2 (PLZ). The 10 left
characters of NAME$, the 4 right numbers of NUMBER, ZIP and the 10 left
characters of CITY$ are displayed. The whole file can be scrolled. WINDOWPOS(0,0) CUSTOMER.PLZ = 0 RGB(2) = 0,128,0 H% = SELECT(CUSTOMER,2,0,"Customers",";Name;Number;ZIP;City",2,"", NAME$,10,NUMBER,4,ZIP,,CITY$,10) CASE H% OF -1 ...
/* no data records found OF 1
... /* a data record was selected OF 0
... /* no data record was selected ENDCASE Sample
2: It shall be
possible to select any number of customer data records in SELECT with the <RETURN> key. After the SELECT has been terminated with F10 the selected
data records shall be edited again. Therefore a one-digit field TAG$ is
defined in the file CUSTOMER. This field is usually empty. In SELECT this
field is defined as Mark Field. If the field is marked, an asterix is
entered. A separate secondary key is specified for the field TAG$ in the file
specification. After the SELECT the selected data records can be found and
processed by this secondary key. ON SELECT(RETURN)
MACRO MARK ON SELECT(F10)
MACRO PROCESS.TAG F10_TAG% = 0 CUSTOMER.NR = 0 /*
Primary key. Start at the beginning of the file WINDOWPOS(0,0) RGB(2) = 0,128,0 FIELDS$ = "NUMBER,,NAME$,,ZIP,,CITY$" H% = SELECT(CUSTOMER,0,0,"CUSTOMER",";Name;Number;ZIP;City",2,"", #TAG$,2,$FIELDS$) ON SELECT(RETURN)
RESET ON SELECT(F10)
RESET IF F10_TAG% = 1 /* F10 was pressed:
process marked data records THEN N1: CUSTOMER.KZ$ =
"*" STARTS(2)
CUSTOMER /* Secondary key 2 is CUSTOMER.TAG$ ON
ERROR GOTO ENDE END ... /*
process data record
CUSTOMER.TAG$ = " " /* reset tag WRITE CUSTOMER ON ERROR
... END GOTO
N1 /* goto next data record ENDIF ENDE: ... Macro
MARK: READSELECT ON ERROR
... END
/* read current data record IF CUSTOMER.KZ$ = "*" /* data record is marked THEN CUSTOMER.KZ$ = " " /* reset ELSE CUSTOMER.KZ$ = "*" /* mark ENDIF WRITE CUSTOMER ON
ERROR ... END /* write data record UNGETCHAR CURSDN$ /* goto next data record Macro PROCESS.TAG
F10_TAG% = 1 QUITSELECT /* Quit SELECT Sample 3: Display fields of another Index File ON SELECT MACRO
GET.CITY H% = SELECT(CUSTOMER,0,0,"Customer","",0,"",NUMBER,,ZIP,,$CITIES.NAME$) Macro GET.CITY
CITIES.ZIP = CUSTOMER.ZIP READ CITIES ON ERROR
CITIES.NAME$ = "" END Sample 4: Display auxiliary variable ON SELECT MACRO
GET.CITY H% = SELECT(CUSTOMER,0,0,"Customer","",0,"",NUMBER,,ZIP,,$H_CITY$) Macro GET.CITY
CITIES.ZIP = CUSTOMER.ZIP READ CITIES ON ERROR
CITIES.NAME$ = "" END H_CITY$ = NOBLANK$(1,CITIES.NAME$) |
||||||||||||||||||||||||||||||||||
|
See also: |
EBUS_SELECT_LINEWIDTH_HORIZONTAL EBUS_SELECT_LINEWIDTH_VERTICAL |