docu Routines Coded by Hermang Mansilla ( hh_mm@yahoo.com )
docu sub EditCell$ (Column, Row, Length, Text$)
docu This function paints an edit field in reverse video @ (Row,Column)
docu of length Length with Text$ as default value.
docu can be edited with left, right, home, end, del, backspace
docu Finish editing with up, down, enter , escape
docu The Key used to finish the editing is stored in ExitKey$
docu sub ClearArea(fromx, fromy, sizex, sizey, " ", 0 | 1)
docu sub FrameArea(fromx, fromy, sizex, sizey, "++++=|", 0 | 1 )
docu sub InpBox$(x,y,mode$,TagLabel$,length,default$)
docu this prints TagLabel$ @(x,y) and calls EditCell$() to get input
docu sub nextfield(field,maxfields,ExitKey$) updates field according to
docu Value of ExitKey$
TRUE=-1:FALSE=0
Tapiz$=" "
export sub FrameArea(posx,posy,sizx,sizy,corners$,modo)
if corners$="" then corners$="++++-|" fi
if modo=0 then
rem draw corners
? @ (posx,posy) mid$(corners$,1,1);
? @ (posx+sizx-1,posy) mid$(corners$,2,1);
? @ (posx+sizx-1,posy+sizy-1) mid$(corners$,3,1);
? @ (posx,posy+sizy-1) mid$(corners$,4,1);
rem draw horiz
for i=1 to sizx-2
? @ (posx+i,posy) mid$(corners$,5,1);
? @ (posx+i,posy+sizy-1) mid$(corners$,5,1);
next i
rem draw verti
for j=1 to sizy-2
? @ (posx,posy+j) mid$(corners$,6,1);
? @ (posx+sizx-1,posy+j) mid$(corners$,6,1);
next j
fi
if modo=1 then
rem draw corners
? reverse @ (posx,posy) mid$(corners$,1,1);
? reverse @ (posx+sizx-1,posy) mid$(corners$,2,1);
? reverse @ (posx+sizx-1,posy+sizy-1) mid$(corners$,3,1);
? reverse @ (posx,posy+sizy-1) mid$(corners$,4,1);
rem draw horiz
for i=1 to sizx-2
? reverse @ (posx+i,posy) mid$(corners$,5,1);
? reverse @ (posx+i,posy+sizy-1) mid$(corners$,5,1);
next i
rem draw verti
for j=1 to sizy-2
? reverse @ (posx,posy+j) mid$(corners$,6,1);
? reverse @ (posx+sizx-1,posy+j) mid$(corners$,6,1);
next j
fi
end sub
export sub ClearArea(posx,posy,sizx,sizy,tapiz$,modo)
local i,j,blank$
if tapiz$="" then tapiz$=" " fi
for i=1 to sizx : blank$=blank$+tapiz$ : next i
if modo=0 then
for j=1 to sizy
print @(posx,posy+j-1) blank$;
next j
fi
if modo=1 then
for j=1 to sizy
print reverse @(posx,posy+j-1) blank$;
next j
fi
end sub
export sub EditCell$ (Column, Row, Length, Text$)
local blank$,Position,Key$
ExitKey$ = ""
Position = LEN(Text$)
InsertSwitch=-1
blank$="":for c=1 to Length : blank$=blank$+" " : next c
repeat
print reverse @(Column,Row) blank$;
PRINT reverse @(Column,Row) Text$;
print @( Column-1,Row) " ";
print @( Position + Column-1,Row) mid$(Text$,Position,1);
print reverse@( Position + Column-1,Row) mid$(Text$,Position,1);
if Position=0 then
print @( Column-1,Row) ">";
fi
Key$ = INKEY$
if len(Key$)=1 then
IF InsertSwitch = -1 THEN
IF LEN(Text$) < Length THEN
Text$ = LEFT$(Text$, Position) + Key$ + RIGHT$(Text$, LEN(Text$) - Position)
Position = Position + 1
ENDIF
ELSEIF Position < Length THEN
IF Position = LEN(Text$) THEN
Text$ = Text$ + Key$
ELSE
MID$(Text$, Position + 1, 1) = Key$
ENDIF
Position = Position + 1
ENDIF
fi
if Key$="esc" or Key$="enter" then
ExitKey$ =Key$
fi
if Key$="key8" or Key$="backspace" then
IF Position > 0 THEN
Text$ = LEFT$(Text$, Position - 1) + RIGHT$(Text$, LEN(Text$) - Position)
Position = Position - 1
ENDIF
fi
if Key$="home" then Position = 0 fi
if Key$="left" then
IF Position > 0 THEN Position = Position - 1 fi
fi
IF Key$="right" then
if Position < LEN(Text$) THEN Position = Position + 1 fi
FI
if Key$="end" then
Position = LEN(Text$)
fi
IF Key$="del" then
if Position < LEN(Text$) THEN
Text$ = LEFT$(Text$, Position) +RIGHT$(Text$, LEN(Text$) - Position - 1)
fi
FI
if key$="ins" then InsertSwitch = -1 - InsertSwitch fi
if Key$="up" or Key$="down" or Key$="tab" then
ExitKey$ = Key$
fi
until (ExitKey$<>"" )
print @( Column-1,Row) " ";
PRINT @ (Column, Row) blank$;
PRINT @ (Column, Row) Text$;
return Text$
end sub : REM CellEdit
export sub InpBox$(x,y,mode$,label$,length,def$)
local indent,blank$,i,Ready$
for i=1 to length : blank$=blank$+" " :next i
indent=len(label$)+2
print @(x,y) label$;
print reverse @(x+indent,y) blank$;
print reverse @(x+indent,y) def$;
if mode$="Input" then
Ready$=EditCell$(x+indent,y,length,def$)
else
Ready$=def$
fi
print @(x,y) label$;
print @(x+indent,y) blank$;
print @(x+indent,y) Ready$;
return Ready$
end sub
export sub nextfield(f,n,Key$)
local regresa
regresa=f
if Key$="enter" or Key$="down" or Key$="tab" then
regresa=f+1
if regresa>n regresa=1
fi
if Key$="up" then
regresa=f-1
if regresa=0 regresa=n
fi
if regresa=f regresa=f+1
if regresa>n regresa=1
return regresa
end sub
               (
geocities.com/sunsetstrip/palms/1624/yabasic)                   (
geocities.com/sunsetstrip/palms/1624)                   (
geocities.com/sunsetstrip/palms)                   (
geocities.com/sunsetstrip)