֥ե饤֥ܺ߷׽
NCURSESѤ߷ץ饤֥ 
2009.8.17

Assistant form library details specifications (the screen design library which I used NCURSES for) v3 .0 

Ϥ
ܥ饤֥MS-Access ǤʤߤΥ֥եʥƥȥܥåȥåɤߤ̡ˤLinux  xterm  Kterm ڤ TeraTermΥߥʥ륽եȲ̤饤֥Ǥ
ܥ饤֥Ѥ뤳ȤǡPostgreSQLǡ١ιɽڤӡԤȤޤ륿פηȤơߤΥСǤϥƥȷ̲߷ͷDATEΣĤΥפͤǽˤʤäƤޤ
ʤܥޥ˥奢ɼԤ NCURSES 饤֥̤Ƥ뤳Ȥ˵ҤƤޤΤ᥵ץˤ NCURSES ؿ˴ؤƤϤƤޤ

0 Preamble 
This library is a library operating a familiar assistant form (the screen that text box and a grid coexisted) with terminal software screens such as xterm and Kterm of Linux and TeraTerm in MS-Access. 
I can perform indication of line information from a PostgreSQL database and input and output operation by using this library. As a model of the type that I can operate, I can come to operate a text type, a currency type, numerical value type, a value of four types of DATE type in a current version. 


ǽ
ƥȥܥåȥåɤˤϰʲξϽޤ

1. Function explanation 
I can input it into text box and a grid in the following conditions. 

̾			
ƥȷ	ѿѤʸ	Х(ECPGǤVARCHARȤưޤ)
NUMERIC	Ĺ	ݣ(ECPGǤINTEGERȤưޤ)
CURRENCY	Ĺ	ݣ(ECPGǤINTEGERȤưޤ)
DATE	ѿʸ	DATEϴŪ˥ƥȷƱˤʤޤեޥåȤECPGǤTIMESTAMP()Ȥưޤ

A name     A value capacity text type alphanumeric character and character string of full size     138 bytes(I treat it as VARCHAR type in an ECPG source to generate.) 
NUMERIC type long integer - 2147483647-2147483647(I treat it as INTEGER type in an ECPG source to generate.) 
CURRENCY type long integer - 2,147,483,647-2,147,483,647(I treat it as INTEGER type in an ECPG source to generate.) 
I agree with a text type basically and treat character string DATE type of a DATE type alphanumeric character. A format is treated as TIMESTAMP() in an ECPG source to generate. 

ǽϰ
֥եǤϰʲϰϤǽǤ

1.1 A function range 
I can define it in an assistant form in the following ranges.

̾	ϰ	
٥		
ƥȥܥå		
å	åɤΤߡ塿԰	
ѥͥ	ˣԤŤĥƥȥܥå֡磱	
(MAXCOL)	col
̹(MAXLINE)		row

A name     384 range label text box     384 grids     Only as for one grid. By two lines arrange text box to one piece of 384 columns of less than /52 lines panels. 18 pieces at the maximum 

ư
륫ϰʲΥǰưޤ

1.2 cursor movement 
Selker Sor moves with the following keys. 

ƥȥܥå
Ȣ˿ʤबǽƥȥܥåǻߤޤ롣
Ȣ
TAB˿ʤߺǽƥȥܥåǻߤ롣

With text box  I advance before, but stop in last text box. 
Ȣ TAB which returns behind I advance before and stop in last text box. 

å
߹ԤΤ߱˰ư
߹ԤΤߺ˰ư
Τ߲˰ư
Τ߾˰ư
TAB˿ʤߡԤκǸǼιԤ˰ưʤʤߡǸΥޤãǽιԤ귫֤

A grid   Only a line is moved now by the right   Only a line is moved now by the left   Only a line moves below now   It is movement TAB only on a line now I advance aside and advance while moving to the next line by the last of a line and I come back to the first line if I arrive at the last cell and repeat it.

---------------------------------------------------------------------------------------
뵡ǽ
°Ȥƺ꤬ͤ͡͡ޤϼξϤǾܺ٤ޤեꤷޤޤ̵ͭꡢư̵ͭޤ
åɤǤ˥ȥ񤭹ޤ

1.3  A cell function 
, , setting of  are possible as an attribute of a cell. This explains the details in the next chapter, but sets it with a screen definition file. In addition, setting of note existence / note nothing, setting of cursor movement existence / nothing are possible. 
Setting to write in a title at every line is possible with a grid.

---------------------------------------------------------------------------------------
ե
֥եե
֥եñȥʥƥȥܥåˤȽ祻ʥåɡˤκߤ̤ƥȥեǤʲ˸ܤΥե򼨤ޤ

2.   A definition file 
2.1  An assistant form definition file 
An assistant form is text file to define the screen which coexisted of a set cell (a grid) as an independent cell (text box). I show below a file of a sample.
---------------------------------------------------------------------------------------
㥰åɤȥƥ
COLS=136	#for form window columns
ROWS=44	#for form window rows

CELL_LENGTH=4,20,30,15,15,14,14,14,0
CELL_ALIGN=right,left,left,left,left,right,right,right,0
CELL_ACTION=edit,edit,edit,edit,edit,edit,edit,edit,0
GRID_SX=0
GRID_SY=14
GRID_EX=134
GRID_EY=42
GRID_TITLES=No,ʪ̾,̾,TEL,FAX,ñ,Ŀ,,0
GRID_FIELD_TYPE=numeric,text,text,text,text,currency,currency,currency,0
GRID_SKIP_STEP= skip,step,step,step,step,step,step,step,0

LABEL_X=2,2,2,2,2,83,83,83,0
LABEL_Y=4,6,8,10,12,4,6,8,0
LABEL_LENGTH=10,10,10,10,10,12,10,12,0
LABEL_TEXT=No,ʪ̾,̾,TEL,FAX,ñ,Ŀ,,0
TEXTBOX_NO=0,1,2,3,4,5,6,7,0
TEXTBOX_X=18,18,18,18,18,99,99,99,0
TEXTBOX_Y=2,4,6,8,10,2,4,6,0
TEXTBOX_LENGTH=4,20,30,15,15,14,14,14,0
TEXTBOX_ALIGN=RIGHT,LEFT,LEFT,LEFT,LEFT,RIGHT,RIGHT,RIGHT,0
TEXTBOX_ACTION=edit,edit,edit,edit,edit,edit,edit,edit,edit,0
TEXTBOX_FIELD_TYPE= numeric,text,text,text,text,currency,currency,currency,0
TEXTBOX_SKIP_STEP =skip,step,step,step,step,step,step,step,0

㥰åɤȥѥͥƥ
COLS=138	#for form window columns
ROWS=43	#for form window rows

LABEL_X=1,6,27,58,74,90,105,120,0
LABEL_Y=3,3,3,3,3,3,3,3,3
LABEL_LENGTH=4,20,30,15,15,14,14,14,0
LABEL_TEXT=No,ʪ̾,̾,TEL,FAX,ñ,Ŀ,,0

PANEL_COLS=136
PANEL_ROWS=4
PANEL_SX=0
PANEL_SY=5
PANEL_DIFF=3
PANEL_NUM=3

TEXTBOX_NO=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0
TEXTBOX_X=1,1,6,6,27,27,58,58,74,74,90,90,105,105,120,120,0
TEXTBOX_Y=1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,0
TEXTBOX_LENGTH=4,4,20,20,30,30,15,15,15,15,14,14,14,14,14,14,0
TEXTBOX_ALIGN=RIGHT,LEFT,RIGHT,LEFT,LEFT,LEFT,RIGHT,RIGHT,RIGHT,RIGHT,RIGHT,RIGHT,CENTER,RIGHT,
LEFT,CENTER,CENTER,CENTER,CENTER,CENTER,0
TEXTBOX_ACTION=EDIT,NONE,EDIT,EDIT,NONE,EDIT,EDIT,EDIT,EDIT,NONE,NONE,EDIT,NONE,EDIT,EDIT,NONE,
EDIT,EDIT,EDIT,EDIT,NONE,NONE,0
TEXTBOX_FIELD_TYPE=NUMERIC,TEXT,TEXT,TEXT,TEXT,CURRENCY,CURRENCY,CURRENCY,CURRENCY,
CURRENCY,CURRENCY,CURRENCY,CURRENCY,CURRENCY,CURRENCY,CURRENCY,CURRENCY,0
TEXTBOX_SKIP_STEP=step,step,skip,step,skip,step,skip,step,skip,step,skip,step,skip,step,step,step,skip,0

CELL_LENGTH=4,20,30,15,15,14,14,14,0
CELL_ALIGN=right,left,left,left,left,right,right,right,0
CELL_ACTION=edit,edit,edit,edit,edit,edit,edit,edit,0
GRID_SX=0
GRID_SY=14
GRID_EX=134
GRID_EY=42
GRID_TITLES=No,ʪ̾,̾,TEL,FAX,ñ,Ŀ,,0
GRID_FIELD_TYPE=numeric,text,text,text,text,currency,currency,currency,0
GRID_SKIP_STEP=skip,step,step,step,step,step,step,step,0

֥եȤñȥФơ֥륫ΰƱɽ뵡ǽäɥ̤ΤȤؤޤ
ޤեѹ뤳Ȥǡβ̡Ģɼβ̤ޤ
ޡϥȤ̣Ԥ磱ХȤޤɤߤȤ뤳Ȥޤ
ջ
åɤǤϺǽΣԤϥȥѤͽ󤵤Ƥ뤿ᡢԤΥåɤǤɬԺɬפޤ
aseǲ߷פ祰åɤκϰ֤ϣܤˤȥإåˤ֥󥿤ɽ뤳Ȥޤ

It points at the window screen which had a function to display a list of a table column at the same time for an independent cell with an assistant form. 
In addition, I can make a screen only for a list, a screen only for a book vote by changing this definition file. 
A # mark means comment and can read it to 1,023 bytes per one line at the maximum. 
Instructions 
* First one line has to make two lines with a grid only for one line by all means with a grid so that it is made reservations for titles. 
* When a making start position of a grid does a screen in ase in from the third line when I design it, I can display a position counter in the header right. 

---------------------------------------------------------------------------------------
եεǽ
ʲϼ̡ʥᥤեˤΥȹԿꤷޤ
COLS
ROWS

CELL_LENGTH		åɾΥĹ󤴤Ȥ˥ޤǶڤꤷޤ
CELL_ALIGN		åɾΥƥȤ֤󤴤Ȥ˥ޤǶڤꤷޤ
CELL_ACTION		åɾΥѡԲĤ󤴤Ȥ˥ޤǶڤꤷޤ
GRID_SX		եΣؼγϰ֤ꤷޤ
GRID_SY		եΣټγϰ֤ꤷޤ
GRID_EX		եΣؼνλ֤ꤷޤ
GRID_EY		եΣټνλ֤ꤷޤ
GRID_TITLES		åɤξɽ륿ȥ󤴤Ȥ˥ޤǶڤꤷޤ
GRID_FIELD_TYPE	åɾΥϥפ󤴤Ȥ˥ޤǶڤꤷޤ
GRID_SKIP_STEP	åץ򥻥뤴Ȥ˥ޤǶڤꤷޤ
DB_TITLES		ǡ١ܤ󤴤Ȥ˥ޤǶڤꤷޤ

LABEL_X		ñȥФ٥γϣؼ
LABEL_Y		ñȥФ٥γϣټ
LABEL_LENGTH		ñȥФ٥Ĺ
LABEL_TEXT		ñȥФ٥ʸ
TEXTBOX_NO		ñȥֹʣݣ
TEXTBOX_X		ñȥΣؼ
TEXTBOX_Y		ñȥΣټ
TEXTBOX_LENGTH	ñȥĹ
TEXTBOX_ALIGN	ƥȤ֤򥻥뤴Ȥ˥ޤǶڤꤷޤ
TEXTBOX_ACTION	ƥȤλѡԲĤ򥻥뤴Ȥ˥ޤǶڤꤷޤ
TEXTBOX_FIELD_TYPE	ƥȤϥפ򥻥뤴Ȥ˥ޤǶڤꤷޤ
TEXTBOX_SKIP_STEP	åץ򥻥뤴Ȥ˥ޤǶڤꤷޤ

PANEL_COLS		ѥͥ륦ɥ
PANEL_ROWS		ѥͥ륦ɥιԿ
PANEL_SX		եΣؼγϰ֤ꤷޤ
PANEL_SY		եΣټγϰ֤ꤷޤ
PANEL_DIFF		ΥѥͥȤκʬԿ
PANEL_NUM		ѥͥο

2.2  A function of a definition file 
The following definitions set the number of the columns and linage of the main screen (a main form).

COLS 
ROWS 

CELL_LENGTH      I divide length of a cell on a grid with a comma every line and set it. 
CELL_ALIGN       I divide placement of a text in a cell on a grid with a comma every line and set it. 
CELL_ACTION      I divide cell use / use impossibility on a grid with a comma every line and set it. 
GRID_SX      I set a start position of X-axis cell in a form. 
GRID_SY      I set a start position of Y-axis cell in a form. 
GRID_EX      I set an end position of X-axis cell in a form. 
GRID_EY      I set an end position of Y-axis cell in a form. 
GRID_TITLES      I divide a title to display on a grid with a comma every line and set it. 
I divide an input type of a cell on a GRID_FIELD_TYPE grid with a comma every line and set it. 
DB_TITLES which I divide a GRID_SKIP_STEP skip cell with a comma every cell and set        I divide a database item with a comma every line and set it. 

LABEL_X:      Start X-axis LABEL_Y: of a label for an independent cell      Start Y-axis LABEL_LENGTH: of a label for an independent cell         Length LABEL_TEXT: of a label for an independent cell       Label letter TEXTBOX_NO: for an independent cell       Independent cell number (0-383) TEXTBOX_X:        X-axis position TEXTBOX_Y: of an independent cell        Y-axis position TEXTBOX_LENGTH: of an independent cell   Length TEXTBOX_ALIGN: of an independent cell    I divide placement of a text in a cell with a comma every cell and set it. 
TEXTBOX_ACTION:   I divide use / use impossibility of a text in a cell with a comma every cell and set it. 
TEXTBOX_FIELD_TYPE:   I divide an input type of a text in a cell with a comma every cell and set it. 
TEXTBOX_SKIP_STEP:    I divide a skip cell with a comma every cell and set it. 

PANEL_COLS:       Width PANEL_ROWS: of a panel window       Linage PANEL_SX: of a panel window         I set a start position of X-axis cell in a form. 
PANEL_SY:         I set a start position of Y-axis cell in a form. 
PANEL_DIFF:       It is linage PANEL_NUM: for a difference with the next panel        The number of panels to make
---------------------------------------------------------------------------------------
إåե
̤ξɽإåޤ

2.3  A header definition file 
I define a header to display on the main screen.
---------------------------------------------------------------------------------------
COLS=136	#for header window columns
ROWS=4	#for header window rows
CELL_LENGTH=132,0
CELL_ALIGN=CENTER,0
CELL_ACTION=EDIT
GRID_SX=0
GRID_SY=1
GRID_EX=134
GRID_EY=1
GRID_TITLES=Linux Subforms  1.0,0

եåե
̤Τβɽեåޤ󤴤Ȥη׻̤ɽޤ

2.4 A footer definition file 
I define a footer displaying a bottom of a thing of the main screen. I display a calculation result every line mainly.
---------------------------------------------------------------------------------------
COLS=136	#for footer window columns
ROWS=4	#for footer window rows
CELL_LENGTH=4,20,30,15,15,14,14,14,0
CELL_ALIGN=right,left,left,left,left,right,right,right,0
CELL_ACTION=EDIT
GRID_SX=0
GRID_SY=1
GRID_EX=134
GRID_EY=1
#GRID_TITLES=No,ʪ̾,̾,TEL,FAX,ñ,Ŀ,,0

֥ե̾ܺ߷
֥եᥤ̤ϰʲΣĤι¤Τޤ

3. assistant form screen details design assistant form Maine screens are defined with six following structure bodies.
---------------------------------------------------------------------------------------
˥ƥȥܥåѥ¤
typedef struct textbox {
	struct textbox *next; //Next link for Textbox
	struct textbox *prev;  //Previous link for Textbox
	char *s;    //ϵڤSQLη̤򥻥Ĺʬɽ
	unsigned long n;   //̤
	int no;    //ƥȥܥåֹ0 1 2 3 ġ
	int x;    //ե०ɥΣؼ
	int y;    //ե०ɥΣټ
	int c;    //ƥȥܥåֹ1 2 3 ġ
	int col;    //ƥȥܥåֹ0 1 2 3 ġ
	int len;    //ƥȥܥåĹ
	int attr; //̤
	int ftype;   //եɤηTEXT NUMERIC CURRENCY ġ
	int action;   //ƥȥܥåԽǽԽԲġ
	int align;    //ƥȥܥå饤
} TextBox;
˥åѥ¤
struct cell {  int no;    //åɥֹ0 1 2 3 ġ
	int x;    //ե०ɥΣؼ
	int y;    //ե०ɥΣټ
	int c;    //åɥֹ1 2 3 ġ
	int len;    //åɥĹ
	int attr;    //̤
	int ftype;   //եɤηTEXT NUMERIC CURRENCY ġ
	int action;   //åɥ륢ԽǽԽԲġ
	int align;    //åɥ륢饤
	char s[MAX_STR];   //ϵڤSQLη̤磱Хɽ
	WINDOW * cell;
};
˥ѥͥѥ֥ɥѹ¤
struct PanelBox {
	WINDOW *panel;    //ѥͥ륦ɥ
	int sx;      //ѥͥ륦ɥΣؼϰ
	int ex;      //ѥͥ륦ɥΣؼλ
	int sy;      //ѥͥ륦ɥΣټϰ
	int ey;      //ѥͥ륦ɥΣټλ
	int width;     //
	int height;     //
};
˥ѥ֥ɥѹ¤
	struct SubForm {  WINDOW *vs;    //륦ɥʥĹܣ塿ԡ
	int col;     //save column
	int line;     //save line
	int no;     //Textbox number
	int n;     //Textbox number
	int x;     //x col
	int y;     //y line
	int c;     //Cell position of numeric
	int len;     //Cell length
	int ftype;    //Filed type
	int action;    //Cell action
	int align;     //Cell aligment
	int stype;    //Cell skip or step.
};
˥ᥤե०ɥѹ¤
	struct VewBox {
	WINDOW *form;
	int panel_num;				//ѥֹͥ save number
	int maxlabel;				//٥κ
	int alltext;				//ѥͥΥƥֹ
	int maxtext;				//ƥȥκ
	int t_col;					//ƥȥΥֹ
	int t_line;					//ƥȥιֹ
	int t_n;					//ƥȥֹ
	int t_len;					//ƥȥĹ
	int t_c;					//ƥȥΥݥ
	int t_x;					//ƥȥξX
	int t_y;					//ƥȥξY
	int t_ftype;				//ƥȥΥեɥ(TEXT or NUMERIC or DATE or CURRNCY)
	int t_action;				//ƥȥΥ(EDIT or NONE)
	int t_align;				//ƥȥ饤(LEFT or RIGHT or CENTER)
	int t_stype;				//ƥȥΥåפȥƥå(SKIP or STEP)
	int g_col;					//åɥΥֹ
	int g_line;					//åɥιֹ
	int g_no;					//åɥֹ
	int g_len;					//åɥΤĹ
	int g_c;					//åɥΥݥֹ
	int g_x;					//åɥξX
	int g_y;					//åɥξY
	int g_ftype;				//åɥΥեɥ
	int g_action;				//åɥΤΥ
	int g_align;				//åɥΥ饤
	int g_stype;				//åɥΥåפȥƥå
	int g_dbindex;				//ģ¥åɥΥǥåݥ*splitDBbuff[index][]Τֹ
	int dbstartline;			//ģ󤫤饰åɤɽǽΥ饤splitDBbuff[index][]Τΰ־
	int dbstartcol;				//ģ󤫤饰åɤɽǽsplitDBbuff[index][]Τΰ־
	} xt[MAX_FORM];    //磱(cygwinξϺ磳ˤƲ)

˥ᥤե־¤
	struct FormBox { // WINDOW *form; /*Form WINDOW*/
	int sx;     //ե०ɥΣؼϰ
	int ex;     //ե०ɥΣؼλ
	int sy;     //ե०ɥΣټ峫ϰ
	int ey;     //ե०ɥΣټλ
	int lcol;     //ԤΥο
	int width;    //̤
	int height;    //̤
	int attr;     //̤
	struct SubForm pos[MAX_COL];  //ƥȥܥåΰ֤ʺ磳ġ
	struct SubForm st[MAX_COL][MAX_ROW]; //åɾΥ֤ʺ磵ԡ
	struct PanelBox pt[MAX_PANEL];  //եΥƥȥܥåꥢʺ磱ġ
	struct cell cp[MAX_COL][MAX_ROW]; //åɾΥ°ʺ磵ԡ
	char *splitDBbuff[MAX_DB_LINE][MAX_COL];//DBgrid()ѡDBιܤ˴ݥassget()Ѥ롣
} ft[MAX_FORM];    //磱(cygwinξϺ磳ˤƲ)

	char *splitDBbuff[MAX_COL];//textbox()ѡDBιܤݥUPDATE INSERTѤΰŪassput()Ѥ롣

ʾƥȥܥååɡѥͥƥȤȤᥤեа֤֤ޤ
Τۤ٥뤬ޤ٥ϥᥤեľܽ񤭹ޤޤ
٥ϰʲޤʤ٥Ϻ磳ֽޤ

It is installed in a relative position in a main form with text box, a grid, a panel text as things mentioned above. 
In addition, there is a label, but a label is written in on a main form directly. 
A label has the following definitions. In addition, greatest 384 can install a label.
---------------------------------------------------------------------------------------
LABEL_X=",    //ե०ɥΣؼ٥
LABEL_Y=",    //ե०ɥΣټ٥
LABEL_LENGTH=",   //٥Ĺʺ磱Хȡ
LABEL_TEXT=",    //٥ƥ 	

ξܺ
å
 ̾Υå

֥եᥤ̾ΥåɤϰʲΣĤCURSESؿꤵޤ

xt[no].form = newwin(rows,xcol,fy,fx);
ǡѿno ϣᥤեࡢإåեå˻Ѥޤ
rowsxcol ϡեrowsxcol̾ͤꤵޤ
fyϡᥤեΣټϰ֤Ǥfxϣؼϰ֤Ǥ
⤷֥եʣɥɽ wsubform.hMAX_FORMͤ䤷Ʋ

ft[no].st[c][j].vs = subwin(xt[no].form,1,length[l]+2,fy+grid_sy+j,(grid_sx+k+0));

̿ϥåѥƤޤǡst¤ΤѿcϹԥ̣ޤ
ιԿϣĹѿlength[l]+2ꤵޤLength[]եˤCELL_LENGTHͤˤʤޤ
ܣ䤷ƤΤϽķɽ뤿;ǤѿjϹԿ򥫥Ȥޤѿgrid_sxϳϰ֤ե뤫ꤵƤΤǡѿkƥĹ­Ƥķʬ;򣱤Ȥޤ
ʾ塢ե०ɥΥֹԤƱˡե˵Ҥ줿°缡cp[]¤Τ˽񤭹ߤޤåɤϺ磳ߣԤΥޤ

4.  The details of cell making 
4.1 A grid 
4.1.1  A normal grid 

A grid on assistant form Maine screen is set by two following CURSES functions. 

xt[no]. Form = newwin(rows,xcol,fy,fx); 
Here, as for variable no, main form, 1 use header, 2 for a footer 0. 
rows and xcol are set by a value of the definition item name of rows and xcol of a definition file. 
fy is Y-axis start position of a main form. fx is X-axis start position. 
Please increase values of MAX_FORM of wsubform.h when a window wants to display plural assistant forms. 

ft[no]. st[c][j]. vs = subwin(xt[no]. form,1,length[l]+2,fy+grid_sy+j,(grid_sx+k+0)); 

This order makes a cell for grids. Here, variable c of st structure health means a line column. 
As for the linage of a cell, length is set in variable length[l]+2 with 1. Length[] becomes a set point of a certain CELL_LENGTH in a definition file. 
It is a blank to display a ruled line long that is increased with +2. Variable j counts linage. Because a start position is set by a definition file, variable grid_sx adds length every each variable k column to this and takes blank 1 for a ruled line long. 
I write in a cell attribute described in a definition file at a cp[] structure body sequentially as things mentioned above at the same time to perform cell placement on a form window. Grid can make a cell of 384 columns *52 lines at the maximum.
---------------------------------------------------------------------------------------
 ģ¥å
åɤκ̾ΥåɤƱǤwsubform.hƤsplitDBbuff[][]malloc()줿ƱȤ뤳Ȥޤ
Ʊwsubform.h줿g_dbindexѤDBԤΰ֤İ뤳ȤǥåɤιϢ뤷splitDBbuff[][]򥹥뤹뤳Ȥޤ
ģ¥åɤECPG̩ܤ˴ϢƤޤΤᡢģ¥åɤκˤ ase ECPGǽѤ뤳Ȥ侩ޤ
ase β̥եκECPGӥƥץ졼Ȥsubform()ɲäǣģ¥åɤޤ
ģ¥åɤǥץꥱȯ硢UPDATE  INSERT Ǥϡݥåץåץե०ɥΥƥȥܥåϤǽˤ뤿 ݥ splitDBbuff[]ѰդޤåѤΣǤ̵ˤʤäƤޤ
 splitDBbuff[] ѤƤ assputDB() ؿǤϡECPGνӻѸsplitDBbuff[]γޤǤưŪ˹Ԥޤ
ưECPG򻲹ͤˤƤ

4.1.2   A DB grid 
A making process of a grid is the same as a normal grid, but can take a line and the same period done malloc() of splitDBbuff[][] defined by wsubform.h. 
I can scroll splitDBbuff[][] which I connected with a line of a grid by grasping a position of DB line using g_dbindex defined at the same time by wsubform.h. Operation of a DB grid is related to an ECPG source and closeness. Therefore I recommend that I use an ECPG source generation function of ase for making of a DB grid. 
I can treat a DB grid just to add making and ECPG source generation of a screen file of ase and subform() of a template. 
When I developed an application with a DB grid, I prepared pointer arrangement splitDBbuff[] to enable input and output from text box of a popup form window in UPDATE and INSERT. I am not be it for a one-dimensional arrangement by a two-dimensional arrangement for grids. 
This splitDBbuff[]  assputDB which uses ()  By a function, I perform initialization of inside arrangement of ECPG and opening of splitDBbuff[] after use automatically. 
 Please refer to an automatic ECPG source to generate.
---------------------------------------------------------------------------------------
ƥȥܥå
ƥȥܥåξϥꥹȹ¤Ϣ褦tpȤ̾ι¤Υݥ󥿤ˤޤΥꥹȹ¤ƬǸޤpos[]Ȥ¤vsƥȥܥåؤޤ
Pos[]ϥ륦ɥ°եɤߤȤ줿塢tpΤ᤹¤TextBoxˤСѿꤵޤ
ʲ̤Ǥ

	ft[no].pos[i].vs = subwin(xt[no].form,1,Textpos[j][3]+2,fy+Textpos[j][2],Textpos[j][1]);

ƥȥܥåpos[]¤Τ˥ޤե˽񤭹ޤ줿ݥϥѿTextps[][]ˤäɤߤȤ졢ᥤեξŪ˥ޤTextpos[][3]ϥĹǤ
ޤTextpos[][1]ڤӡTextpos[][2]ϥᥤեΣؼټˤʤޤ
ƥȥܥåκϸߤλͤǤϣĤȤʤäƤޤ
ջ 
ƥȥܥåΥϥåɤƱ褦ֽޤȥȤδ֤ˣδֳ֤褦ˤƤ
ʤȥ̣[ ]Ǳ¦ ] ʤʤޤϱ¦ ] åɤȤϰ㤤դäƤ뤿Ǥ
 ] ̵Ƥƶ̵ХåɤƱ褦֤ƤϤޤ

4.2 Text box 
I make a chain of list structure in the case of text box and I get up and exchange it with a structure body pointer named tp to be able to operate it from the outside. vs in a structure position line of pos[] points at a text box cell till the last from the top of this list structure. 
Pos[] manages a cell window, and a cell attribute is set by the member variable that there is in structure body TextBox which tp shows after it was read than a definition file. 
It is the scene where the following makes a cell. 

    ft[no]. pos[i]. vs = subwin(xt[no]. form,1,Textpos[j][3]+2,fy+Textpos[j][2],Textpos[j][1]); 

	Text box defines a cell to a pos[] structure body. A position written in at a definition file is read by local variable Textps[][], and it is relatively defined a cell on a main form. Textpos[][3] is length of a cell. 
	In addition, Textpos[][1] and Textpos[][2] become the X-axis in a main form, the Y-axis. 
	A maximum number of text box becomes 384 with current specifications. 
	InstructionsI can arrange a cell of text box in the same way as a grid, but please leave one column of interval between a cell and cells. 
	] of the right side that means a cell unless I do so it  I become it without  vanity. This] of the right side  The reason is because it is added unlike a  grid. 
	 ]  A problem is not not have  even if I post it in the same way as a grid if there is not influence.
---------------------------------------------------------------------------------------
ѥͥƥ
ѥͥƥȤϡƥȥܥåνft[no].pt[k].panelȤ֥ɥǼȹԤǴ褦ˤΤǤƥѥͥ磳ĤΥƥȥܥåֽޤѥͥκͤϣĤˤʤޤ

ft[no].pt[k].panel = subwin(xt[no].form,panel_rows,panel_cols,l,panel_sx);

ѥͥΥƥȥܥåϰʲΤ褦derwin()ǺޤͤϥƥȥܥåƱǤ

ft[no].pos[i].vs = derwin(ft[no].pt[k].panel,1,Textpos[j][3]+2,Textpos[j][2],Textpos[j][1]);

4.3 A panel text 
A panel text is ft[no]. with a set of text box pt[k]. I put it in an assistant window of panel and was able to manage it in a line and a line. Every each panel can arrange text box of greatest 384. The maximum of the number of the panels becomes 18. 

ft[no]. pt[k]. panel = subwin(xt[no]. form,panel_rows,panel_cols,l,panel_sx); 

Text box in a panel is made in derwin() as follows. Specifications are the same as text box. 

ft[no]. pos[i]. vs = derwin(ft[no]. pt[k]. panel,1,Textpos[j][3]+2,Textpos[j][2],Textpos[j][1])
---------------------------------------------------------------------------------------
°
°ˤϰʲޤ
	°align 1 2 3󥿡
	Խ°action 0 Խǽ1 ԽԲġ
	Ϸ°ftype
եɷˤϣĤηꡢץʲοͤǶʬޤ
	TEXT		1
	NUMERIC		2
	BOOL		3
	CURRENCY	4
	DATE		5
	SINGLE		6
	DOUBLE		7
	BYTE		8

	°stype 0åס1 ƥåס
°°Υ饤֥ؿsrcep(),slcep(),sccep()ΣĤδؿƤӽФƷꤷޤ
ƥȥܥåξ硢Խ°ϥƥȥܥåؿformtext()ϻtp->actionե饰ͤξ
ϤĤˡȤäƤޤåɤξcp[].actionˤʤޤ
Ϸ°tekitinput()ؿ⤫饤֥ؿjmvwgetnstr()ؿƤӽФƥȷͷ̲߷Υ
ڤʬޤ̲߷ξ硢˥ޤղäCURLIB01饤֥ؿvarprint()ƤӽФޤ
ʤƥʸʳƥڡޤΤϻڡ󥰽ԤޤspacerȤؿ󤬤̤ޤʸʳΥڡϥåɤǤϲΤȤʤ륢饤ȿžɽޤ
°ȤΤϡư˥򥹥åפ뤫ɤ°ǤեTEXTBOX_SKIP_STEP줿ƤǥưͻҤѲޤȽؿformtext()åɤǤgrid()ǥưΥޥ˹ԤäƤޤ

4.4 An attribute 
An attribute of a cell has the following. 
1,     Placement attribute (one two align   3 center) in a cell
2,     Editing attribute (0 action editing possibility, one editing impossibility)
3,     There are eight models in input type attribute (ftype) Field type and divides it with the following numerical value in a program. 
	TEXT         1 
	NUMERIC      2 
	BOOL         3 
	CURRENCY     4 
	DATE         5 
	SINGLE       6 
	DOUBLE       7 
	BYTE         8 

Four)     A placement attribute in a choice attribute (0 one stype skip steps) cell calls three functions of attached library function srcep(),slcep(),sccep() and is decided. 
In the case of text box, an editing attribute takes the method how a value of a tp-action flag admits the input only in the case of 0 in text box operation function formtext() at input time. It is cp[]. in the case of a grid I become action. 
An input type attribute calls a library function jmvwgetnstr() function from a tekitinput() function and cuts a text type, numerical value type, currency-shaped type into pieces. In the case of a currency type, I call CURLIB01 library function varprint() which adds a comma to every three columns. 
In addition, each cell is buried other than a letter entirely in space. On this account Spey thing processing is performed at input time. An arrangement in a function of spacer serves as the role. Space except a letter pulls an underline becoming a change of a wide ruled line with a grid, and reversing display does a cursor. 
A choice attribute is an attribute skipping in a cell at the time of cursor movement. A state of cursor movement changes by contents defined by TEXTBOX_SKIP_STEP of a definition file. This judgment goes every command of cursor movement in grid() with operation function formtext(), a grid.
---------------------------------------------------------------------------------------

ƥȥܥååΥưϰʲˤʤޤ
ƥȥܥå	
ޥå	ǽ	
KEY_IC KEY_DC KEY_BACKSPACE TAB KEY_DOWN KEY_RIGHT 0x0d 0x0a KEY_UP KEY_LEFT KEY_F(1)-KEY_(F11 KEY_F(12)) ESC ¾ʸ	ڤؤ ʸʱ󥻥ξƤ ʸ ˿ʤᡢǸΥãǽΥ ˿ʤᡢǸΥãǽΥ ˿ʤᡢǸΥãǽΥ ˿ʤᡢǸΥãǽΥ ᤹ ᤹ ƥȥܥåξ101-111 ѥͥξ301-311֤ ƥȥܥåξ199 ѥͥξ399֤ ƥȥܥåξ100 ѥͥξ300֤ ʸͤ	
 å	
ޥå	ǽ	
KEY_IC KEY_DC KEY_BACKSPACE TAB KEY_DOWN KEY_RIGHT 0x0d 0x0a KEY_UP KEY_LEFT KEY_F(1)-KEY_(F11 KEY_F(12)) ESC ¾ʸ	ڤؤ ʸʱ󥻥ξƤ ʸ 򱦤˰ưǲԤκǸΥãǽΥ 򲼤˰ư 򱦤˰ư 򲼤˰ư ˰ư 򺸤˰ư 201-211֤ 299֤ 200֤ ʸͤ	

5.   Cursor operation 
As for the text box, the cursor movement in a grid, it is operated the following. 
Text box key map function KEY_IC KEY_DC KEY_BACKSPACE TAB KEY_DOWN KEY_RIGHT 0x0d 0x0a KEY_UP KEY_LEFT KEY_F(1) -KEY_(F11 KEY_F(12))  A letter returning 300 in the case of 100 panels in the case of text box to return 399 in the case of 199 panels in the case of text box to return 301-311 in the case of 101-111 panels in the case of text box to return a cursor returning the cursor which comes back to the first cell if I advance with a deletion cursor forward in the deletion (I delete all in the case of a Right cell) 1 character left in the change 1 character right of epenthesis / overwrite of ESC others and advance with the cursor which comes back to the first cell if I reach the last cell forward and advance with the cursor which comes back to the first cell if I reach the last cell forward and advance with the cursor which comes back to the first cell if I reach the last cell forward and reach the last cell behind behind, the numerical input 
 A grid 
 A key map function 
 KEY_IC KEY_DC KEY_BACKSPACE TAB KEY_DOWN KEY_RIGHT 0x0d 0x0a KEY_UP KEY_LEFT KEY_F(1) -KEY_(F11 KEY_F(12))  A letter returning 200 to return 299 to return 201-211 to move to the left with a cursor moving to the top with a cursor moving with a cursor moving to the right with a cursor moving with the cursor which comes back to the first cell if I move to the right with a deletion cursor in the deletion (I delete all in the case of a Right cell) 1 character left in the change 1 character right of epenthesis / overwrite of ESC others and reach the last cell of a bottom line below below, the numerical input
---------------------------------------------------------------------------------------
ؿ
֥եˤϣĤδؿǥޤ

6.   An access function 
I can access an assistant form by 39 functions.
---------------------------------------------------------------------------------------
int grid(int no,int maxtext,int xcol);
int no		ɥֹ
int maxtext	֤줿ƥȤκ
int xcol		̤κ

δؿϥåǥϤդμˤʬޤ
ʸazAZڤӡ09οȤʤޤ
Insert ˤʸϤڤؤԤޤ
DeleteBackspaceʸϥ롼jmvwgetnstr()ؿλͤ˽ޤ
ڤTABǥưԤե󥯥󥭡200299֤ͤޤ
	F1	201
	F2	202
	F3	203
	F4	204
	F5	205
	F6	206
	F7	207
	F8	208
	F9	209
	F10	210
	F11	211
	F12	299
	ESC100֤ޤ
	ϻǤESCξ֤ᤷޤUNDO

δؿեɤ߼ʣΥ٥ʣΥƥȥܥåޤ
int textbox(int no, int fy, char *f);
int no		ɥֹ
int fy		ɥγϣټ
char *f		֥եե̾

char *addspace(int len, char *s);
int len
char *s

δؿϥƥȥܥåǥϤդμˤʬޤ
int formtext(int no,int maxtext, int xcol);
int no		ɥֹ
int maxtext	֤줿ƥȤκ
int xcol		̤κ
δؿϥƥȥܥåԤޤ
ʸazAZڤӡ09οȤʤޤ
Insert ˤʸϤڤؤԤޤ
DeleteBackspaceʸϥ롼jmvwgetnstr()ؿλͤ˽ޤ
ڤTABǥưԤե󥯥󥭡100199֤ͤޤ

	F1	101
	F2	102
	F3	103
	F4	104
	F5	105
	F6	106
	F7	107
	F8	108
	F9	109
	F10	110
	F11	111
	F12	199
	ESC100֤ޤ
	ϻǤESCξ֤ᤷޤUNDO

δؿեɤ߼ҤȤĤΥѥͥξʣΥ٥ʣΥƥȥܥåȤޤ
int paneltext(int no, int maxpaneltext, int xcol);
int no		ɥֹ
int maxpaneltext	֤줿ƥȤκ
int xcol		̤κ
δؿϥѥͥƥȤԤޤ
ʸazAZڤӡ09οȤʤޤ
Insert ˤʸϤڤؤԤޤ
DeleteBackspaceʸϥ롼jmvwgetnstr()ؿλͤ˽ޤ
ڤTABǥưԤե󥯥󥭡300399֤ͤޤ

	F1	101
	F2	102
	F3	103
	F4	104
	F5	105
	F6	106
	F7	107
	F8	108
	F9	109
	F10	110
	F11	111
	F12	199
	ESC100֤ޤ
	ϻǤESCξ֤ᤷޤUNDO

δؿեɤ߼ҤȤĤΥѥͥξʣΥ٥ʣΥƥȥܥåȤޤ
int panels(int no, int xcol,int rows,int fy, char *f);
int no		ɥֹ
int xcol		̤κ
int rows		̤κ
int fx		ɥγϣؼ
int fy		ɥγϣټ
char *f		֥եե̾
subwin()ǥѥͥderwin()ǥƥȥܥåޤ

δؿեɤ߼ꥰåɤޤ
int wsubform(int no, int xcol,int rows,int fx ,int fy, char *f);
int no		ɥֹ
int xcol		̤κ
int rows		̤κ
int fx		ɥγϣؼ
int fy		ɥγϣټ
char *f		֥եե̾
Wsubform()ؿϥᥤΥ⥸塼Ǥ֥եνĲ礭ꤷåΰޤ
֤͡ե०ɥ(xcol)
fyͤˤդƲ㤨ХإåɥԤƤϥᥤ󥦥ɥϡ
  ꣲԤδֳ֤ʤФʤʤǤ⤷Τ˴ֳ֤ʤȥΰ֤ޤ

δؿϥ°Ĵޤ
int sf_status(int no, int type, char opt);
int no		ɥֹ
int type		ƥȥܥåᣱåɡᣲѥͥƥȡᣳ
int opt		w,yx,y,X,n,l,c,a,A,f,s
δؿϸߤΥξĴޤܺ٤ϰʲˤʤޤ
	w	ɥ¸ߤ뤫ɤ̵ϡݣ֤
	y	ե०ɥΥΣټ
	x	ե०ɥΥΣؼ
	Y	ιֹ
	X	Υֹʣ
	n	ֹʣ
	l	Ĺ
	c	Υֹʣ
	a	Υ饤
	A	Υ
	f	Υեɥ
	s	Υå
	D	DBgrid()ΤѲǽDBΥ쥳ɤǼsplitDBbuff[index][]indexֹФ
	֤͡ƥץ

δؿʣΥƥȥܥåǤΥưֻԤޤ
int sf_tlocate(int no, int col);
int no		ɥֹ
int col		ֹ
ƥȥܥåΥ֤ѹޤ
֤͡0Ԥ-1

δؿϥåǤΥưֻԤޤ
int sf_glocate(int no, int col, char line);
int no		ɥֹ
int col		ֹ
int line		ֹ
֤͡0Ԥ-1
åɾΥ֤ѹޤ

δؿϥƥȥܥåʸ񤭹ߤޤ1ʸ2ХȰʾʸ-1֤
int sf_tput(int no, int col, char *s);
int no		ɥֹ
int col		ߤΥֹ
char *s		ƥȥܥå˽񤭹ʸ
֤͡0Ԥ-1
Τƥȥܥåʸ񤭹ߤޤΥ饤°˽äƽ񤭹ߤޤ

δؿϥåɥʸ񤭹ߤޤ1ʸ2ХȰʾʸ-1֤
int sf_gput(int no, int col, int line, char *s);
int no		ɥֹ
int col		ֹ
int line		ֹ
char *s		åɥ˽񤭹ʸ
֤͡0Ԥ-1
åɤʸ񤭹ߤޤΥ饤°˽äƽ񤭹ߤޤ

δؿϥƥȥܥåʸФޤ
int sf_tget(int no, int col,char *s);
int no		ɥֹ
int col		ߤΥֹ
char *s		ƥȥܥå뤫ɤ߹ʸ
֤͡0Ԥ-1
Τƥȥܥåʸɤ߹ߤޤ

δؿϥåɥ뤫ʸФޤ
int sf_gget(int no, int col, int line,char *s);
int no		ɥֹ
int col		ֹ
int line		ֹ
char *s		åɥ뤫ɤ߹ʸ
֤͡0Ԥ-1
åɥ뤫ʸɤ߹ߤޤ

	δؿϥƥȥܥåʸ򱦴󤻡󤻡󥿡󤻤ޤ
int sf_tcep(int no, int col, int align, char *s);
int no		ɥֹ
int col		ֹ
int align		͡͡󥿡
char *s		ƥȥܥå˽񤭹ʸʸ
֤͡0Ԥ-1
ƥȥܥåΥ饤Ȥѹޤ

δؿϥåɥʸ򱦴󤻡󤻡󥿡󤻤ޤ
int sf_gcep(int no, int col, int line, int align, char *s);
int no		ɥֹ
int col		ֹ
int line		ֹ
int align		͡͡󥿡
char *s		åɥ˽񤭹ʸʸ
֤͡0Ԥ-1
åɥΥ饤Ȥѹޤ

δؿϥƥȥܥåο3头Ȥ˥ޤդޤ
int sf_tvarprint(int no, int col, char *s);
int no		ɥֹ
int col		ߤΥֹ
char *s		ƥȥܥå뤫ɤ߹ʸ
̲߷ΥƥȥܥåͤˣΥޤդޤ

δؿϥåɥο3头Ȥ˥ޤդޤ
int sf_gvarprint(int no, int col, int line, char *s);
int no		ɥֹ
int col		ֹ
int line		ֹ
char *s		åɥ뤫ɤ߹ʸ
̲߷ΥåɥͤˣΥޤդޤ


ģ´Ϣδؿ

	 ʲDBбؿǤcol  line ΰ֤դˤʤäƤ뤳ȤդƤ
	 DB˴Ϣؿüʽ򤷤Ƥޤ
	  äwsubform.h Ƥ splitDBbuff[][]  ase ǥ줿եξѤޤ

	int sf_DBgrid(int no,int maxtext,int xcol,int startline,int DBcount,int maxcol);
	int no		ɥֹ
	int maxtext	֤줿ƥȤκ
	int xcol		̤κ
	int startline	DBԤɽ
	int DBcount		ɤ߹DBκ
	int maxcol		ɤ߹DBκܿ
	
	δؿϥǡ١Ϣ뤷åɤԤޤ
	ʸazAZڤӡ09οȤʤޤ
	Insert ˤʸϤڤؤԤޤ
	DeleteBackspaceʸϥ롼jmvwgetnstr()ؿλͤ˽ޤ
	ڤTABǥưԤե󥯥󥭡200299֤ͤޤ
	F1	201
	F2	202
	F3	203
	F4	204
	F5	205
	F6	206
	F7	207
	F8	208
	F9	209
	F10	210
	F11	211
	F12	299
	ESC100֤ޤ
	ϻǤESCξ֤ᤷޤUNDO

	void sf_initgridcell(int no);
	int no		ɥֹ
	ƤΥåɥ򥹥ڡǽޤ

	int sf_getstartline(int no);
	int no		ɥֹ
	DBϢԤνԤꤷޤ(åɤξ岼ɬ)
	ģ¥åɤɽԤ֤ޤ

	void sf_wrefreshcell(int no,int line,int col);
	int no		ɥֹ
	int line		ֹ
	int col		ֹ
	ꤷɥΥɽޤ

	void sf_wrefreshform(int no);
	int no		ɥֹ
	ꤷɥɽޤ

	void sf_startcell(int no);
	int no		ɥֹ
	Υݥ򣰤ǽޤ
	ꤷɥΥ륫֤ꤷޤ

	void sf_to_text(int in,char *out)
	int in		int ο
	char *out	ͤʸѴХåե
	DBγƹԤsplitDBbuff[][]˳Ǽ뤿˿ͤʸ(ƥ)ޤ

	long sf_to_numeric(char *in);
	char *in	ʸ
	splitDBbuff[][]γƹԤDB˳Ǽ뤿˿ξϿ(long)Ѵޤ

	int sf_to_integer(char *in);
	char *in	ʸ
	ʸͤˤ֤
	splitDBbuff[][]γƹԤDB˳Ǽ뤿˿ξϿ(int)Ѵޤ

	int sf_to_double(char *in);
	ʸ򾮿ޤͤˤ֤ޤ

	void sf_freeDB(int no, int DBcount, int maxcol);
	int no		ɥֹ
	int DBcount	ǡ١θߤιԿ
	int maxcol	ǡ١ιԤκܿ
	ơ֥ΥܤȹԤƤ줿splitDBbuff[][]꤫鳫ޤ

	int sf_ggetDB(int no, int line, int col, int startline,char *s);
	int no		ɥֹ
	int line	DBåɤιֹ
	int col		DBåɤΥֹ
	int startline	åɤΣܤɤ߹DBιֹ
	char *s		DBɤ߹ʸ
	åɥƱ֤ˤǡ١Ԥȥξɤ߼ޤ

	int sf_gputDB(int no, int line, int col, int startline,char *s);
	int no		ɥֹ
	int line	DBåɤιֹ
	int col		DBåɤΥֹ
	int startline	åɤΣܤ˽񤭹DBιֹ
	char *s		DB˽񤭹ʸ
	åɥƱ֤ˤǡ١ԥ˾񤭹ߤޤ

	int sf_tgetDB(int no, int col, char *s);
	int no		ɥֹ
	int col		ƥȥܥåΥֹ
	char *s		ƥȥܥåɤ߹ʸ
	ƥȥܥåƱ֤ˤǡ١Ԥȥξɤ߼ޤ

	int sf_tputDB(int no, int col, char *s);
	int no		ɥֹ
	int col		ƥȥܥåΥֹ
	char *s		DB˽񤭹ʸ
	ƥȥܥåƱ֤ˤǡ١ԥ˾񤭹ߤޤ

	int sf_tgetDBall(int no);
	int no		ɥֹ
	ƥȥܥåDBƥȥܥå롣

	int sf_assgetDB(int no,int line,int col, char *buff, int size);
	int no		ɥֹ
	int line	ֹ
	int col		ֹ
	char *buff	DBɤ߹ʸ
	int size	ecpg 줿Υ
	ECPG줿sf_DBgrid()ǰ褦splitDBbuff[][]Ÿޤ
	Ʊ˽Ԥޤ
	FETCH줿DBԤ򰷤δؿǤDBɤ߼ѤδؿǤ

	int sf_assputDB(int no,int col, char *buff, int size);
	int no		ɥֹ
	int col		ֹ
	char *buff	DB˽񤭹ʸ
	int size	ecpg 줿Υ
	ƥȥܥåsplitDBbuff[]Ÿ줿ǡ(char*)ECPGǰ褦˸᤹ν򤷤ޤ
	Ʊ˽Ԥޤ
	äINSERT,UPDATEDBؤν񤭹ߤԤ˻Ѥޤ


ľؿ

	ʲ2ĤδؿեѤʤľܥƥȥܥå䥰åɤ뵡ǽޤ

	δؿեѤʤǥƥȥܥåޤ
	aseΥǥ̤ޥɤǣøΥե
	ʬեƽʬ֤Ѥޤ
	int MakeTextBox(int no,int fx,int fy,int xcol,int xrow,int *label_no,char **label_text,int *label_x,int *label_y,int *label_length,int *textbox_no,int *textbox_x,int *textbox_y,int *textbox_length,int *align,int *action,int *field,int *skipstep, int m)

	int no	ɥֹ	
	int fx	ɥؼϰ
	int fy	ɥټϰ
	int xcol	ɥ
	int xrow	ɥ⤵
	int *label_no	٥ֹ
	char **label_text	٥ʸ(٥ƥȤؤΥݥ)
	int *label_x	٥ؼϰ
	int *label_y	٥ټϰ
	int *label_length	٥Ĺ
	int *textbox_no		ƥȥܥåֹ
	int *textbox_x	ƥȥܥåؼϰ
	int *textbox_y	ƥȥܥåټϰ
	int *textbox_length	ƥȥܥåĹ
	int *align	ƥȥܥåʸΰ°(1. 2. 3.󥿡)
	int *action	ƥȥܥåԽ°(0.Խ 1.ԽԲ)
	int *field	ƥȥܥå°
		TEXT.1 NUMERIC.2 BOOL.3 CURRENCY.4 DATE.5 SINGLE.6 DOUBLE.7 BYTE.8
	int *skipstep 	ƥȥܥåư°(0.SKIP 1.STEP)
	int m	ƥȥܥåο

	δؿեѤʤǥåɤޤ
	aseΥǥ̤ޥɤǣøΥե
	ʬեƽʬ֤Ѥޤ
	int MakeWsubForm(int no, int xcol,int rows,int fx ,int fy,int grid_sx,int grid_sy,int grid_ex,int grid_ey,int *length,int *align,int *action,int *field,int *skipstep,char **grid_titles,int m)

	int no		ɥֹ
	int xcol	ɥ
	int rows	ɥ⤵
	int fx 		ɥؼϰ
	int fy		ɥټϰ
	int grid_sx		åɣؼϰ
	int grid_sy		åɣټϰ
	int grid_ex		åɣؼü
	int grid_ey		åɣټü
	int *length		åɳƽ
	int *align		åɳƽʸΰ°(1. 2. 3.󥿡)
	int *action		åɳƽԽ°(0.Խ 1.ԽԲ)
	int *field		åɳƽ°
		TEXT.1 NUMERIC.2 BOOL.3 CURRENCY.4 DATE.5 SINGLE.6 DOUBLE.7 BYTE.8
	int *skipstep		åɳƽΰư°(0.SKIP 1.STEP)
	char **grid_titles		åɳƽʸ(ƥȤؤΥݥ)
	int m			åɤιԿ



7.¾ؿ
֥եľŪʴطΤ뤵ޤޤʽԤؿǤ
char *addspace(int len, char *s);
ʸslenĹڡɲäޤ
int compare(int c, char *p,char *s);
ʸps٤Ʊäʤ cƱ֤ͤޤ
char *cutspace(char *s);
ʸsΤʤˤ륹ڡƺޤ
char * cutspace_right(char *s)
ʸsα¦ˤ륹ڡƺޤ
int dialogmsg(int x,int y,char *buff);
åɥɽλޤ
int ifspace(int len,char *s);
ʸslenĹڡ뤫ɤĴ٤ޤ̵äϥФο֤ͤޤ
int popmsg(int x,int y,char *buff);
åɥɽʸϤ¥ޤYǤ¾255֤ޤ
int errmsg(int x,int y,char *buff);
åɥɽ줫Υǽλޤ
char *sccep(char *buff);
ʸbuffΥڡ򺸤˴󤻤ޤ
char *slcep(char *buff);
ʸbuff̾Υڡ򱦤˴󤻤ޤ
char *srcep(char *buff);
ʸbuffΥڡξ¦˴󤻤ޤ
char *varprint(char *buff);
ʸbuffΣοб头Ȥ˥ޤդޤǣȤʤޤ
char *vs_ieee_c(WINDOW *vs,int x,int y,char *p,int N);
Cursesؿmvwgetstr()ƤӤޤ

¾ʲδб饤֥꤬ޤϻѤƤޤ
int jmvwgetnstr(WINDOW *win, int y, int x, unsigned char *str, int n, int wmode, int cmode);
WINDOW *win		뤫Ѥɥ
Int y			륦ɥⳫY
Int x			륦ɥⳫX
Unsigned char *str	ʸ
Int n			Խоʸ
Int wmode		⡼
Int cmode		η

δؿʸϤǽǤ
ηͷ̲߷ξ硢ϤϥαüȤʤޤλDeleteڤBackspace
ϥʸƾõޤ
ηƥȷڤӡշξϺϤϤޤλDeleteϱ¦ʸBackspace
Ϻ¦ʸõޤ
ƥȷڤշʸϤȥ饤󤬰ޤշʸäƤޤ
Insertڤؤޤ

As for this function, the full size letter input is possible. 
A model of a cell becomes the input in the case of numerical value type and a currency type from the right-side end of a cell. Delete and a Backspace key erase all the character string in a cell then. 
A model of a cell begins the input with the left in the case of a text type and a date model. As for Delete, a Backspace key erases a letter of the left by a letter of the right side then. 
When a text type and date model character string are input, an underline is pulled. Model character string does not define it in particular on a date. 
A change of insertion overwrite is possible with an Insert key.
---------------------------------------------------------------------------------------
饤֥եˤĤ

֥ե饤֥ϰʲΥե˥֤Ƥޤ

8.  About a library file 

An assistant form library is archived by the following files.
---------------------------------------------------------------------------------------
Libsubform.a
ơ
wsubform.o	֥եॢؿ
curlib01.o	֥եϢؿ
jmvwgetnstr.o	ϴؿ

եϰʲˤʤޤ
wsubform.c	֥եॢؿ
wsubform.h	֥եإåեʥ֥եΤΥѥɬɬס
subform.h	֥եॢؿإåեʥ֥եॢץꥱɬס
curlib01.c	֥եϢؿ
jmvwgetnstr.c	ϴؿ
jmvwgetnstr.h	ϴؿإåե
Makefile °ƤޤΤǡѥͤˤƤ

ջ
˥ƥȥܥåѥؿϴؿwrefresh()ԤäƤޤ
˥ƥڡǤƤ뤿ᡢѥؿʳϥڡɲäʤФʤޤ
˥ƥȥܥåϥꥹϢ˥뤬ưԤᡢưѤեǹԤäƤ
˲ե̷ΤԤȥץब۾ｪλ礬ޤ
˥ѥͥΥƥȥܥåϰưեꤷƤޤΤḽߤѹȥư̷⤬ǽΤդƤ
˥ե०ɥ礭Kterm̤礭ۤ硢顼åɽexit(1)ǽλޤ
˥åɥꥢΤιԤϹ̾ʥȥѤˤʤäƤޤΤǡƥȥܥå磱ԤƤ
aseǥƥȥܥåϢ³Ʋ硢ΥƥȥܥåȤδ֤ˣʾδֳ֤ɬפˤʤޤ
)	ƥȥܥåޤϥåɤΥBSˤ^?ʸϤTERMINFOեˤBS꤬^HˤʤäƤޤ^?ľTICޥɤǥѥ뤹ɬפޤ(ץTERMCAPե°Ƥޤ)
)ܥ饤֥ܸ򰷤ɬEUCѤƤUTF-8ΥޥХʸ򰷤ȤϽޤ󡣤ϥƥȥܥåڤӥå⥻뤬ʸбASCIIڡʸʤɬפ뤫Ǥ

<Instructions> 
1.     An access function for text box does not perform wrefresh() in a function. 
2.     All|all of the cell must add space operation so that it is covered in space when they operate it other than an exclusive access function. 
3.     Please perform text box with a definition file so that a cursor moves to list chain order when I want to change movement order. 
4.     There is the case that a program is terminated abnormally when I set it with contradiction to filing it a screen definition. 
5.     Text box on a panel sets movement order with a definition file. Because contradiction may occur for cursor movement when I change a definition as of that purpose, please be careful. 
6.     Size of a form window displays a case beyond size of a Kterm screen, error message and is finished in exit(1). 
7.     Because I become it for the item names (a title), in the line right on a grid area, one line please be open when I define text box. 
8.     When I define text box in ase aside in succession, distance more than one column is necessary between the next text box. 
9.     When a letter of ^? is input with a BS key in text box or a cell of a grid, setting of the BS key which there is in a TERMINFO file becomes ^H. I get over in ^? and have to compile it by a TIC command. (It is attached with a TERMCAP file of a sample.)
---------------------------------------------------------------------------------------
֥եΥץ
֥եϰʲΤ褦˻Ѥޤ

#include "wsubform.h" //֥եѥإåե򥤥󥯥롼ɤ롣
#include "subform.h" //֥եॢؿΥץȥפ󥯥롼ɥե롣

#define Textbox	1
#define Grid	2
#define Panel	3

#define Tret	199
#define Gret	299
#define Pret	399

extern int wmode;
extern char gridtitles[MAX_POS][MAX_LEN];

extern TextBox	 *begin;
extern TextBox	 *tp;

typedef struct stat Dir;
static Dir dirptr;
static Dir  *fileptr = &dirptr;

char tmp[256];

int subform(void)
{
	int i,j,k;
	int ret;
	char f[128];
	int xcol,rows;
	int maxtext;
	char s[256];

#ifdef PANELS
	strcpy(f,"_subpanels.def");
#else
	strcpy(f,"_subform.def");
#endif

	initscr();

	xcol = COLS;
	rows = LINES;

	cbreak();
	noecho();
	keypad(stdscr, TRUE);
	meta(stdscr, TRUE);

	if(stat(f,fileptr) != 0)
	{
		echo();
		endwin();
		printf("canot find %s\n",f);
		exit(0);
	}

	xcol = wsubform(0,xcol,rows,0,2,f);

#ifdef PANELS
	maxtext = panels(0,xcol,rows,2,f);
#else
	maxtext = textbox(0,2,f);
#endif

	wrefresh(xt[0].form);

	for(i=0;i<MAX_POS;i++)
		memset(gridtitles[i],'\0',MAX_LEN);

#ifdef PANELS
	xcol = wsubform(2,xcol,rows,0,46,"_panel_footer.def");
#else
	xcol = wsubform(2,xcol,rows,0,46,"_footer.def");
#endif
	wrefresh(xt[2].form);

	for(i=0;i<MAX_POS;i++)
		memset(gridtitles[i],'\0',MAX_LEN);

	tp = begin->next;

	for(i=0;i<maxtext;i++)
	{
		sprintf(s,"%d",i+1);
		sf_tput(0,i,s);
		wrefresh(ft[0].pt[k].panel);
		wrefresh(ft[0].pos[i].vs);
		if(tp->next != (TextBox *)NULL)
		{
			tp = tp->next;
		}
	}

	for(i=0,k=1;i<ft[0].lcol;i++)
	{
		for(j=0;j<(ft[0].ey-ft[0].sy)+1;j++)
		{
			sprintf(s,"%d",k);
			sf_gput(0,i,j,s);
			k++;
		}
	}

	xcol = wsubform(1,xcol,rows,0,0,"_header.def");
	sprintf(ft[1].cp[0][0].s,"%s","Sample screen for Subform Library v.2.2");
	mvwprintw(ft[1].st[0][0].vs,0,1,"%s",ft[1].cp[0][0].s);
	wrefresh(ft[1].st[0][0].vs);
	wrefresh(xt[1].form);

	ft[0].pos[0].col = 0;
	ft[0].pos[0].line = 0;
	ft[0].st[0][0].col = 0;
	ft[0].st[0][0].line = 0;

	ret = Gret;
	tp = begin->next;

	while(TRUE)
	{
		if(ret == Tret || ret == Pret)//꥿󥳡ɤǥåɤƥȥܥåڤؤ롣
			ret = grid(0,maxtext,xcol);
		else
#ifdef PANELS
			ret = paneltext(0,maxtext, xcol);
#else
			ret = formtext(0,maxtext, xcol);
#endif
		switch(ret)
		{
		case -1:
			echo();
			endwin();
			exit(0);
			break;

	//for textbox
		case 100: //ESCǥץλ뤳Ȥˤ롣
			if(popmsg(2+8,(LINES/2)-4,"Exit textbox area in Subform?") == 1)
				goto end;
			ret = Gret;  //ĤΥɥؿƱѤ뤿꥿󥳡ɤ򥻥åȤƤ
			break;
		case 101: //F1
			ret = Gret;
			break;
		case 102: //F2
			ret = Gret;
			break;
		case 103: //F3ƥȥܥåʸ򺸵ͤˤ롣
			i = sf_status(0,Textbox,'n');
			sprintf(tmp,"%s",tp->s);
			sf_tcep(0,i,2,tmp);
			ret = Gret;
			break;
		case 104: //F4999999Ȥ999,999Ȥƥƥȥܥå˽񤭹ࡣ
			i = sf_status(0,Textbox,'n');
			sf_tvarprint(0,i,"999999");
			ret = Gret;
			break;
		case 105: //F5ƥȥܥåˡPutɤʸ񤭹ࡣ
			i = sf_status(0,Textbox,'n');
			wrefresh(ft[0].pos[i].vs);
			sf_tput(0,i,"Put");
			ret = Gret;
			break;
		case 106: //F6ƥȥܥåʸɤ߹ߡåɥɽ롣
			i = sf_status(0,Textbox,'n');
			sf_tget(0,i,tmp);
			popmsg(2+8,(LINES/2)-4,tmp);
			ret = Gret;
			break;
		case 107: //F7ƥȥܥåư롣
			sf_tlocate(0,7);
			ret = Gret;
			break;
		case 108: //F8ƥȥܥå°åɥɽ
			sprintf(tmp,"w=%d,x=%d,y=%d,X=%d,n=%d,l=%d,c=%d,a=%d,A=%d,f=%d,s=%d",
					sf_status(0,Textbox,'w'),sf_status(0,Textbox,'x'),sf_status(0,Textbox,'y'),sf_status(0,Textbox,'X'),
					sf_status(0,Textbox,'n'),sf_status(0,Textbox,'l'),sf_status(0,Textbox,'c'),sf_status(0,Textbox,'a'),
					sf_status(0,Textbox,'a'),sf_status(0,Textbox,'f'),sf_status(0,Textbox,'s'));
			popmsg(2+8,(LINES/2)-4,tmp);
			ret = Gret;
			break;
		case 109: //F9ƤΥƥȥܥåʸ򱦤˴󤻤롣
			i = sf_status(0,Textbox,'n');
			sprintf(tmp,"%s",tp->s);
			sf_tcep(0,i,1,tmp);
			wrefresh(ft[0].pos[i].vs);
			tp = begin->next;
			for(i=0;i<maxtext;i++)
			{
				wrefresh(ft[0].pos[i].vs);
				if(tp->next != (TextBox *)NULL)
				{
					tp = tp->next;
				}
			}
			ret = Gret;
			break;
		case 110: //F10ƤΥƥȥܥåֹ񤭹ߥ󥿡󤻤롣
			tp = begin->next;
			for(i=0;i<maxtext;i++)
			{
				sprintf(s,"%d",i+1);
				sf_tcep(0,i,3,s);
				wrefresh(ft[0].pos[i].vs);
				if(tp->next != (TextBox *)NULL)
				{
					tp = tp->next;
				}
			}
			ret = Gret;
			break;
		case 111: //F11ƤΥƥȥܥåֹ񤭹ࡣ
			tp = begin->next;
			for(i=0;i<maxtext;i++)
			{
				sprintf(s,"%d",i+1);
				sf_tput(0,i,s);
				wrefresh(ft[0].pos[i].vs);
				if(tp->next != (TextBox *)NULL)
				{
					tp = tp->next;
				}
			}
			ret = Gret;
			break;

	//for grid
		case 200: //ESCǥץλ롣
			if(popmsg(2+8,(LINES/2)-4,"Exit grid area in Subform?") == 1)
				goto end;
			ret = Pret;
			break;
		case 201: //F1
			ret = Pret;
			break;
		case 202: //F2
			ret = Pret;
			break;
		case 203: //F3ߤΥΰ֤Ĵ٤塢ʸɤߤȤꥻ󥿡ͤǽ񤭹ࡣ
			i = sf_status(0,Grid,'X');
			j = sf_status(0,Grid,'Y');
			sf_gget(0,i,j,tmp);
			sf_gcep(0,i,2,tmp);
			ret = Pret;
			break;
		case 204: //F4ߤΥΰ֤Ĵ٤塢͡999999ɤ999,999ɤǽ񤭹ࡣ
			i = sf_status(0,Grid,'c');
			j = sf_status(0,Grid,'Y');
			sf_gvarprint(0,i,j,"999999");
			ret = Pret;
			break;
		case 205: //F5
			ret = Pret;
			break;
		case 206: //F6ʸɤߤȤåɥɽ롣
			i = sf_status(0,Grid,'X');
			j = sf_status(0,Grid,'Y');
			sf_gget(0,i,j,tmp);
			popmsg(2+8,(LINES/2)-4,tmp);
			ret = Pret;
			break;
		case 207: //F7ߤΥΰ֤Ĵ٤塢륫ΰư򤹤롣ǸNUMERICΥ˰ư
			i = sf_status(0,Grid,'X');
			j = sf_status(0,Grid,'Y');
			sprintf(tmp,"i=%d/j=%d",i,j);
			if(popmsg(2+8,(LINES/2)-4,tmp)== 1)
				sf_glocate(0,8,32);
			i = sf_status(0,Grid,'f');
			sprintf(tmp,"f=%d",i);
			popmsg(2+8,(LINES/2)-4,tmp);
			if(sf_status(0,Grid,'f') == 4)
			{
				sf_glocate(0,8,1);
			}
			ret = Pret;
			break;
		case 208: //F8ƥȥܥå°åɥɽ
			sprintf(tmp,"w=%d,x=%d,y=%d,X=%d,n=%d,l=%d,c=%d,a=%d,A=%d,f=%d,s=%d",
					sf_status(0,Grid,'w'),sf_status(0,Grid,'x'),sf_status(0,Grid,'y'),sf_status(0,Grid,'X'),
					sf_status(0,Grid,'n'),sf_status(0,Grid,'l'),sf_status(0,Grid,'c'),sf_status(0,Grid,'a'),
					sf_status(0,Grid,'a'),sf_status(0,Grid,'f'),sf_status(0,Grid,'s'));
			popmsg(2+8,(LINES/2)-4,tmp);
			ret = Pret;
			break;
		case 209: //F9դͤƤΥ˽񤭹ࡣ
			for(i=0,k=1;i<ft[0].lcol;i++)
			{
				for(j=0;j<(ft[0].ey-ft[0].sy)+1;j++)
				{
					sprintf(s,"%ld",33335 * 60000);
					sf_gvarprint(0,i,j,s);
				}
			}
			ret = Pret;
			break;
		case 210: //F10ƤΥֹ񤭹ࡣ
			for(i=0,k=1;i<ft[0].lcol;i++)
			{
				for(j=0;j<(ft[0].ey-ft[0].sy)+1;j++)
				{
					sprintf(s,"%d",k);
					sf_gput(0,i,j,s);
					k++;
				}
			}
			ret = Pret;
			break;
		case 211: //F11ֹ񤭹ࡣ
			for(j=0,k=1;j<(ft[0].ey-ft[0].sy)+1;j++)
			{
				for(i=0;i<ft[0].lcol;i++)
				{
					sprintf(s,"%d",k);
					sf_gput(0,i,j,s);
					k++;
				}
			}
			ret = Pret;
			break;

	//for panels
		case 300: //ESCǥץλ롣
			if(popmsg(2+8,(LINES/2)-4,"Exit panels area in Subform?") == 1)
				goto end;
			ret = Gret;
			break;
		case 301: //F1
			ret = Gret;
			break;
		case 302: //F2
			ret = Gret;
			break;
		case 303: //F3
			ret = Gret;
			break;
		case 304: //F4
			ret = Gret;
			break;
		case 305: //F5
			ret = Gret;
			break;
		case 306: //F6
			ret = Gret;
			break;
		case 307: //F7
			sf_tlocate(0,12);
			ret = Gret;
			break;
		case 308: //F8
			ret = Gret;
			break;
		case 309: //F9ѥͥƥȥܥåĴʸ򱦴󤻤롣
			i = sf_status(0,Panel,'n');
			sprintf(tmp,"%s",tp->s);
			sf_tcep(0,i,1,tmp);
			ret = Gret;
			break;
		case 310: //F10ѥͥƥȥܥåֹդꡢ󥿡󤻤롣
			tp = begin->next;
			for(i=0;i<maxtext;i++)
			{
				sprintf(s,"%d",i+1);
				sf_tcep(0,i,3,s);
				wrefresh(ft[0].pos[i].vs);
				if(tp->next != (TextBox *)NULL)
				{
					tp = tp->next;
				}
			}
			ret = Gret;
			break;
		case 311: //F11ѥͥƥȥܥåֹ񤭹ࡣ
			tp = begin->next;
			for(i=0;i<maxtext;i++)
			{
				sprintf(s,"%d",i+1);
				sf_tput(0,i,s);
				wrefresh(ft[0].pos[i].vs);
				if(tp->next != (TextBox *)NULL)
				{
					tp = tp->next;
				}
			}
			ret = Gret;
			break;

		default:
			break;
		}
	}

end:
	echo();
	endwin();
}

int main(void)
{
	subform();
}

.sf_DBgrid()Ѥץ
aseECPGǽѤsf_DBgrid()Ѥǡ١ץꥱȯޤ
륽եˤFETCH롢INSERT,UPDATE,DELETEμŪǤΤǡ
ѹ絬ϥץꥱٱѽޤ

int subform(void)
{
	int i,j,k;
	int ret;
	char f[256];
	int xcol,rows;
	int maxtext;
	char s[MAX_STR];

	int xcol2;
	int maxcol;
	int startline;
	
	int line;
	char key1[MAX_STR];
	char key2[MAX_STR];
	char key3[MAX_STR];

	sprintf(f,"%s","_apschtbl.def");
	initscr();

	xcol = COLS;
	rows = LINES;

	cbreak();
	noecho();
	keypad(stdscr, TRUE);
	meta(stdscr, TRUE);

	if(stat(f,fileptr) != 0)
	{
		popmsg((COLS/2)-24,(LINES/2)-4,"ᥤ󥰥åɥեե뤬ꤢޤ");
		echo();
		endwin();
		exit(0);
	}
	if(stat("_inputwin2.def",fileptr) != 0)
	{
		popmsg((COLS/2)-24,(LINES/2)-4,"ѥƥȥܥåեե뤬ꤢޤ");
		echo();
		endwin();
		exit(0);
	}
	if(stat("_header.def",fileptr) != 0)
	{
		popmsg((COLS/2)-24,(LINES/2)-4,"إåȥѥåɥեե뤬ꤢޤ");
		echo();
		endwin();
		exit(0);
	}
	if(stat("_footer.def",fileptr) != 0)
	{
		popmsg((COLS/2)-24,(LINES/2)-4,"ե󥯥󥭡ѥåɥեե뤬ꤢޤ");
		echo();
		endwin();
		exit(0);
	}
	xcol = wsubform(3,140,24,1,19,"_inputwin.def");	//ѥƥȥܥåե򳫤
	maxcol = wsubform(0,140,44,1,2,f);	//ᥤ󥰥åɥեե򳫤
	maxtext = textbox(3,1,19,"_inputwin.def");	//ƥȥܥåŸ롣

	wrefresh(xt[0].form);

	for(i=0;i<MAX_POS;i++)
		memset(gridtitles[i],'\0',MAX_LEN);	//åɥȥ롣

	xcol = wsubform(2,xcol,rows,0,43,"_footer.def");	//եåɥ롣xcol ϥե०ɥ
	sf_gcep(2,0,0,3,"ϲ̤");	//
	sf_gcep(2,12,0,3,"ESCλ");	//
	wrefresh(xt[2].form);

	xcol = wsubform(1,xcol,rows,0,0,"_header.def");	//إåɥ롣
	sf_gcep(1,0,0,1,"v1.0.3");
	sprintf(ft[1].cp[0][0].s,"%s","APscheduler");
	mvwprintw(ft[1].st[0][0].vs,0,1,"%s",ft[1].cp[0][0].s);
	sf_wrefreshcell(1,0,0);
	sf_wrefreshform(1);

	sf_startcell(0);	//åɤΥ륫򺸾֤롣

	ret = Gret;

	while(1)
	{
		startline = sf_getstartline(0);	//DBgrid()λäƤ륹ɬפʣģ¥åɤβ̽Ԥΰ־
		if(schdytbl_disp(0,startline,maxcol) == -1)	//*splitDBbuff[][]򥰥åɤ˽񤭹ɽ롣
		{
			popmsg(12,12,"schtbl_disp():error");
		}
		ret = DBgrid(0,maxtext,xcol,0,DBcount,maxcol);	//ǡ١Ϣѥåɡ*splitDBbuff[][]ɽ롣
		switch(ret)
		{
		case -1:
			echo();
			endwin();
			exit(0);
			break;

		//for grid
		case 200: //ESCǥץλ롣
			if(popmsg((COLS/2)-24,(LINES/2)-4,"Exit grid area in Subform?") == 1)
				goto end;
			ret = Pret;
			break;
		case 201: //F1
		//DBؤѥɥκ
			line = sf_status(0,Grid,'D');
			inputwin_write(3,0,line,maxcol);	//ѥɥɽ롣maxcol ϥƥȥܥåĴѤѲ
			sf_gcep(2,0,0,3,"");
			sf_gcep(2,4,0,3,"");
			sf_gcep(2,5,0,3,"ɲ");
			sf_gcep(2,6,0,3," n+d+t");
			sf_gcep(2,7,0,3," n+d");
			sf_gcep(2,8,0,3," < d");
			while(1)
			{
				ret = formtext(3,maxtext, 140);	//ѥɥμ(F1 - F12 + ESC)
				switch(ret)
				{
				case -1:
					echo();
					endwin();
					exit(0);
					break;
				case 100:
					if(popmsg((COLS/2)-24,(LINES/2)-4,"λޤ") == 1)
						goto end;
					break;
				case 101:
					goto mainwin;
					break;
				case 105:
					//ƤΥƥȥܥåɬפʹܤmalloc()solitDBbuff[]˳Ǽ롣
					//ECPG¦UPDATEԤassputDB()ѸsplitDBbuff[]ϼưŪ˳롣
					sf_tgetDBall(3);
					sprintf(key1,"%s",ft[0].splitDBbuff[line][0]);
					sprintf(key2,"%s",ft[0].splitDBbuff[line][1]);
					if(Update_schtbl(0,key1,key2,sqlcode,line) == -1)
					{
						popmsg((COLS/2)-24,(LINES/2)-4,"ǡ١ޤ");
					}
					goto mainwin;
					break;
				case 106:
					//ƤΥƥȥܥåɬפʹܤmalloc()solitDBbuff[]˳Ǽ롣
					//ECPG¦INSERTԤassputDB()ѸsplitDBbuff[]ϼưŪ˳롣
					sf_tgetDBall(3);
					sprintf(key1,"%s",ft[0].splitDBbuff[line][0]);
					sprintf(key2,"%s",ft[0].splitDBbuff[line][1]);
					if(Insert_schtbl(0) == -1)
					{
						popmsg((COLS/2)-24,(LINES/2)-4,"ǡ١ɲýޤ");
					}
					goto mainwin;
					break;
				case 107:
					if(popmsg((COLS/2)-24,(LINES/2)-4,"̾դȼ¹Ի֤ǥǡޤ") == 1)
					{
						sprintf(key1,"%s",ft[0].splitDBbuff[line][0]);
						sprintf(key2,"%s",ft[0].splitDBbuff[line][1]);
						if(Delete_schtbl(key1,key2,sqlcode) == -1)
						{
							popmsg((COLS/2)-24,(LINES/2)-4,"ǡ١ޤ");
						}
					}
					else
					{
						goto mainwin;
					}
					goto cleardisp;
					break;
				case 108:
					if(popmsg((COLS/2)-24,(LINES/2)-4,"̾դǥǡޤ") == 1)
					{
						sprintf(key1,"%s",ft[0].splitDBbuff[line][0]);
						sprintf(key2,"%s",ft[0].splitDBbuff[line][1]);
						if(Delete_schtbl(key1,key2,sqlcode) == -1)
						{
							popmsg((COLS/2)-24,(LINES/2)-4,"ǡ١ޤ");
						}
					}
					else
					{
						goto mainwin;
					}
					goto cleardisp;
					break;
				case 109:
					sf_tget(3,1,s);
					sprintf(tmp,"%s հƤΥǡޤ",s);
					if(popmsg((COLS/2)-24,(LINES/2)-4,tmp) == 1)
					{
						sprintf(key1,"%s",ft[0].splitDBbuff[line][1]);
						if(Delete_schtbl(key1,key2,sqlcode) == -1)
						{
							popmsg((COLS/2)-24,(LINES/2)-4,"ǡ١ޤ");
						}
					}
					else
					{
						goto mainwin;
					}
					goto cleardisp;
					break;
				}
			}
			cleardisp:
			sf_initgridcell(0);	//ƤΥåɥ򥹥ڡǽޤ
			mainwin:
			sf_gcep(2,0,0,3,"ϲ̤");
			sf_gcep(2,4,0,3,"          ");
			sf_gcep(2,5,0,3,"          ");
			sf_gcep(2,6,0,3,"          ");
			sf_gcep(2,7,0,3,"          ");
			sf_gcep(2,8,0,3,"          ");
			ret = Pret;
			break;
		case 202: //F2
			ret = Pret;
			break;
		case 203: //F3
			ret = Pret;
			break;
		case 204: //F4
			ret = Pret;
			break;
		case 205: //F5
			ret = Pret;
			break;
		case 206: //F6
			ret = Pret;
			break;
		case 207: //F7
			ret = Pret;
			break;
		case 208: //F8
			ret = Pret;
			break;
		case 209: //F9
			ret = Pret;
			break;
		case 210: //F10
			ret = Pret;
			break;
		case 211: //F11
			ret = Pret;
			break;
		case 299: //F12
			ret = Pret;
			break;

		default:
			break;
		}
		sf_freeDB(0,DBcount,maxcol);	//splitDBbuff[][]롣
	}

end:
	echo();
	endwin();
}

int main(void)
{
	subform();
}


