Set Channel and Template - GRID SENDMSG() Function 80
Syntax
TF$=SENDMSG(sysgui,id,80,channel,template${,context{,ERR=lineref}})
Description
This function binds the grid to a Visual PRO/5 SELECT, SQL SELECT, or an MKEYED file channel that has already been opened on the specified channel.
Parameter |
Description |
sysgui |
SYSGUI channel. |
id |
Grid control ID. |
80 |
Number of this SENDMSG() function. |
channel |
Visual PRO/5 SELECT, SQL SELECT, or MKEYED file channel. Use the negative value of SQL SELECT channels. |
template$ |
Template describing the records read on the channel. Each template field can contain any number of user-defined attributes, as described in the table below. These attributes are case-sensitive and must be entered in upper case. Because spaces are delimiters for user-defined attributes, underscores must be substituted for spaces when they are needed in labels and masks. Note that this is not a template; it is a template description string. The FATTR() must be used when converting a string template to a template description string. |
For more information, see Data Aware Grid Channels.
Example
The following code sample creates a window and grid, sets up a template called DATAREC_DESC$, opens a PRO/5 select channel, then binds the channel to the grid. The data file, datagrid.dat, is distributed with GUIBuilder and is available on the BASIS website. The template definition sets column headings for the displayed fields, and an input field length of 50 is specified for the TITLE field:
sysgui=unt; open (sysgui)"X0"
dim event$:tmpl(sysgui)
event=len(event$)
print (sysgui)'window'(0,20,390,120,"",$00000082$,$ff$)
print (sysgui)'grid'(100,20,20,360,84,$8842$,3,3,5,15,101)
result$=sendmsg(sysgui,100,68,12,$$)
datarec_desc$="cdnumber:c(6*=10):SHOW=1 LABEL=Number:,"+
: "title:c(50*=10):SHOW=1 LENGTH=50 LABEL=Title:"
dim datarec$:datarec_desc$
sel_chan=unt; select (sel_chan)datarec$ from "datagrid.dat"
tf$=sendmsg(sysgui,100,80,sel_chan,datarec_desc$)
escape