| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | [3/6] Formlib |
>>> Part 3 of 6...
*ptr++ = fdata[curfield][++count];
}
fdata[curfield][--maxpos] = '\0';
FORM_repaint(f_f,curfield,fdata[curfield]);
FORM_repos(f_f,curfield,curpos);
}
}
break;
case END_FORM_INPUT : if(change == FORMTRUE)
{
int i;
for(i=0;imaxfields;i++)
{
strcpy(f_f->data[i],fdata[i]);
}
f_f->havedata = FORMTRUE;
}
fast_cursortype(NORMALCURSOR);
continue;
case ALT_END : key = END_FORM_INPUT;
change = FORMFALSE;
break;
default : if(curpos < maxlen)
{
if(FORM_validkey(f_f,curfield,key) == FORMTRUE)
{
change = FORMTRUE;
if(insmode == 0)
{
count = curpos;
memmove(&fdata[curfield][curpos+1],
&fdata[curfield][curpos],maxpos-curpos);
fdata[curfield][++maxpos] = '\0';
fdata[curfield][curpos] = key;
curpos++;
FORM_repaint(f_f,curfield,fdata[curfield]);
}
else
{
fast_putch(key);
fdata[curfield][curpos] = key;
curpos++;
}
if(curpos >= maxpos)
{
maxpos = curpos;
fdata[curfield][maxpos] = '\0';
} /* end if curpos >= maxpos */
FORM_repos(f_f,curfield,curpos);
} /* end if valid key */
} /* end if curpos < maxlen */
}
}
return change;
}
void FORM_repos(struct form* f_f,int cf,int cp)
{
fast_gotoxy(f_f->fieldx[cf] + cp,f_f->fieldy[cf]);
}
void FORM_repaint(struct form* f_f,int cf,char* txt)
{
fast_gotoxy(f_f->fieldx[cf],f_f->fieldy[cf]);
fast_cprintf("%*c",f_f->fieldlen[cf],' ');
fast_cprintf("%s",txt);
}
void FORM_puthelp(struct form* f_f,int cf)
{
fast_gotoxy(f_f->helpx,f_f->helpy);
Attrib = f_f->formattrib;
fast_clreol();
if(f_f->helptext[cf] != NULL)
{
Attrib = f_f->helpattrib;
fast_gotoxy(f_f->helpx,f_f->helpy);
fast_cprintf("%s",f_f->helptext[cf]);
}
Attrib = f_f->fieldattrib;
}
int FORM_getkey()
{
int key,lbyte,hbyte;
union REGS regs;
regs.h.ah = 0x10;
int86(0x16, ®s, ®s);
key = regs.x.ax;
hbyte = (key&0xff00) >> 8;
lbyte = key&0x00ff;
if (lbyte == 0 || lbyte == 224) return hbyte+256;
return lbyte;
}
int FORM_validkey(struct form* f_f,int cf,int key)
{
switch(f_f->fieldtype[cf])
{
case 1 : if(isdigit(key)) return FORMTRUE;
if(key == '.' || key == '-' || key == '(' || key == ')')
return FORMTRUE;
return FORMFALSE;
case 2 : if(isdigit(key)) return FORMTRUE;
return FORMFALSE;
case 3 : if(isdigit(key)) return FORMTRUE;
if(key == '-' || key == '/') return FORMTRUE;
return FORMFALSE;
case 4 : if(isdigit(key)) return FORMTRUE;
if(key == '-' || key == '/') return FORMTRUE;
return FORMFALSE;
default: if(isprint(key) && key != 8) return FORMTRUE;
return FORMFALSE;
}
return FORMFALSE;
}
void FORM_showeditmode(int mode)
{
int oldx,oldy;
oldx = fast_getx()+1;
>>> Continued to next message...
___ Blue Wave/DOS v2.21
--- Maximus 3.01
* Origin: The Software Parlour (3:635/544)SEEN-BY: 50/99 78/0 620/243 623/630 632/349 635/503 544 727 711/401 409 410 SEEN-BY: 711/413 430 808 809 932 934 712/515 713/888 714/906 800/1 7877/2809 @PATH: 635/544 50/99 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.