
int TextBox(int no,int fx,int fy,int xcol,int xrow,int label_x,int label_y,int label_length,char *label_txt,int textbox_no,int textbox_x,int textbox_y,int textbox_length,int align,int action,int field,int skipstep)
{
	static FILE *fp;
	static WINDOW *vs;
	static TextBox *gp;
	static int ch;
	static int i,j,k,l,m,n;
	static int  c, x, y;
	static char p[MAX_STR];
	static int xcol;
	static int rows;
	static int ncol;
	static int maxcell;
	static int maxtext;
	static char *nl;
	static char def[MAX_DEF][MAX_STR];
	static char wt[MAX_DEF][MAX_STR];
	static int align[MAX_POS];
	static int action[MAX_POS];
	static int field[MAX_COL];
	static int skipstep[MAX_COL];
	static int a;
	static char spacer[MAX_TMP];

	maxtext = m;

	if(maxtext == 0)
		return(0);

	xt[no].maxtext = maxtext;

	for(i=0;i<maxtext;i++)
	{
		Labelpos[i][0] = 0;
		Labelpos[i][1] = 0;
		Labelpos[i][2] = 0;
		Labelpos[i][3] = 0;
		Textpos[i][0] = 0;
		Textpos[i][1] = 0;
		Textpos[i][2] = 0;
		Textpos[i][3] = 0;
	}
	for(i=0;i<maxtext;i++)
	{
		Labelpos[i][0] = label_no[i];
		Labelpos[i][1] = label_x[i];
		Labelpos[i][2] = label_y[i];
		Labelpos[i][3] = label_length[i];
	}
	for(i=0;i<maxtext;i++)
	{
		Textpos[i][0] = textbox_no[i];
		Textpos[i][1] = textbox_x[i];
		Textpos[i][2] = textbox_y[i];
		Textpos[i][3] = textbox_length[i];
	}

	i = 0;
	k = 0;

	memset(tmpbuff1,'\0',sizeof(tmpbuff1));

	for(j=0;j<maxtext;j++)
	{
		ft[no].pos[i].vs = subwin(xt[no].form,1,Textpos[j][3]+2,fy+Textpos[j][2],fx+Textpos[j][1]);
		keypad(ft[no].pos[i].vs,TRUE);
		meta(ft[no].pos[i].vs, TRUE);
		if((gp = (TextBox *)calloc(1,sizeof(TextBox))) == (TextBox  *)NULL)
		{
			return -1;
		}
		if((gp->s = (char *)calloc(2,sizeof(tmpbuff1) + 1)) == (char  *)NULL)
		{
			return -1;
		}

		memset(tmpbuff1,'\0',sizeof(tmpbuff1));
		memset(tmpbuff1,' ',Textpos[j][3]);
		sprintf(gp->s,"%s",tmpbuff1);
		wrefresh(ft[no].pos[i].vs);

		gp->no = i;
		gp->n = i;
		gp->col = i;
		gp->no = Textpos[j][0];
		gp->x = Textpos[j][1];
		gp->y = Textpos[j][2];
		gp->c = i+1;
		gp->len = Textpos[j][3];
		gp->align = align[j];
		gp->action = action[j];
		gp->ftype = field[j];
		gp->stype = skipstep[j];

		ft[no].pos[i].col = i;
		ft[no].pos[i].n = i;
		ft[no].pos[i].c = i+1;
		ft[no].pos[i].len = Textpos[j][3];
		ft[no].pos[i].x = Textpos[j][1];
		ft[no].pos[i].y = Textpos[j][2];
		ft[no].pos[i].align = align[j];
		ft[no].pos[i].action = action[j];
		ft[no].pos[i].ftype = field[j];
		ft[no].pos[i].stype = skipstep[j];

		gp->prev = ending->prev;
		ending->prev = gp;

		gp->next = tp->next;
		tp->next = gp;

		tp = gp;
		i++;
	}

	i--;

	maxtext = i + 1;

	for(k=0;k<=maxtext;k++)
	{
		mvwprintw(xt[no].form,Labelpos[k][2],Labelpos[k][1],"%s",label_text[k]);
	}

	tp = begin->next;
	for(i=0;i<maxtext;i++)
	{
		mvwprintw(ft[no].pos[i].vs,0,0,"[");
		mvwprintw(ft[no].pos[i].vs,0,tp->len+1,"]");
		mvwprintw(ft[no].pos[i].vs,0,1,"%s",tp->s);
		wrefresh(ft[no].pos[i].vs);
		if(tp->next != (TextBox *)NULL)
		{
			mvwprintw(ft[no].pos[i].vs,0,1,"%s",tp->s);
			tp = tp->next;
		}
	}
	mvwprintw(ft[no].pos[i].vs,0,1,"?%s",tp->s);
	wrefresh(ft[no].pos[i].vs);

	return(maxtext);
}

