home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
CLIPPER
/
NCCLIB.ZIP
/
NCCCODE.ZIP
/
NCCPOP.PRG
< prev
next >
Wrap
Text File
|
1992-11-04
|
4KB
|
139 lines
//═══════════════════════════════════════════════════════╕
// Program .....: Nccpop │
// CopyRight ...: 1992 National Computer Consultants │
// All rights are reserved. │
// Author ......: Greg Rice │
//═══════════════════════════════════════════════════════╛
#include "set.ch"
Function Npop_Ask( p_Data, p_Valid, p_Color, p_Padding )
local a , ;
i , ;
pos ,;
maxlen , ;
StartRow , ;
StartCol , ;
sScreen , ;
sColor := SetColor() , ;
sCursor := Set( _SET_CURSOR, 1 ) , ;
sConfirm := Set( _SET_CONFIRM, .t. )
local gets := .f. ,;
get_pos ,;
get_len ,;
get_col ,;
get_input ,;
get_pict ,;
say_pos ,;
getlist:={}
p_Padding := if( p_Padding == NIL, 1, p_Padding )
if p_Color # NIL
SetColor( p_Color )
endif
a := StrToArray( p_Data, '\n' )
maxlen := 0
aeval( a, { |y| maxlen := max( len(y)-if("\"$y,1,0) , maxlen ) } )
maxlen := maxlen + ( p_Padding * 2 )
Startrow := int( (maxrow() - len(a)) / 2 )
Startcol := int( (maxcol() - maxlen) / 2 )
sScreen := savescreen( StartRow-1 , ;
StartCol-1 , ;
StartRow+len(a)+1 , ;
StartCol+maxlen+2 )
WinBox( StartRow-1 , ;
StartCol-1 , ;
StartRow+len(a) , ;
StartCol+maxlen , ;
, ;
5 , ;
.t. ;
)
for i = 1 to len(a)
if '\c' $ a[i]
get_pos := at("\c",a[i])
pos := get_pos + 2
while ( subs(a[i], pos,1) == 'c' )
pos++
enddo
get_len := pos - (get_pos+1)
get_input := space( get_len )
say_pos := StartCol + round((maxlen-len(a[i])+1)/2,0)
get_Col := say_pos + get_pos -1
if empty(p_Valid)
@ StartRow-1+i, Say_pos say subs(a[i],1,get_pos-1)
@ StartRow-1+i, get_col get get_Input pict "@!"
else
@ StartRow-1+i, Say_pos say subs(a[i],1,get_pos-1)
@ StartRow-1+i, get_col get get_Input pict "@!" valid( get_input $ p_Valid )
endif
@ StartRow-1+i, get_col + get_len say subs(a[i],get_pos+get_len+1)
gets := .t.
elseif '\i' $ a[i]
get_pos := at("\i",a[i])
pos := get_pos + 2
while ( subs(a[i], pos,1) == 'i' )
pos++
enddo
get_len := pos-(get_pos+1)
get_input := 0
get_pict := repl("9",get_len)
say_pos := StartCol + round((maxlen-len(a[i])+1)/2,0)
get_Col := say_pos + get_pos -1
if empty(p_Valid)
@ StartRow-1+i, Say_pos say subs(a[i],1,get_pos-1)
@ StartRow-1+i, get_col get get_input pict get_pict
else
@ StartRow-1+i, Say_pos say subs(a[i],1,get_pos-1)
@ StartRow-1+i, get_col get get_input pict get_pict
endif
@ StartRow-1+i, get_col + get_len say subs(a[i],get_pos+get_len+1)
gets := .t.
else
@ StartRow-1+i, StartCol say padc(a[i],maxlen,' ')
endif
next
if gets
read
else
keyboard ''
inkey(0)
endif
restscreen(;
StartRow-1 , ;
StartCol-1 , ;
StartRow+len(a)+1 , ;
StartCol+maxlen+2 , ;
sScreen ;
)
SetColor( sColor )
Set( _SET_CURSOR, sCursor )
Set( _SET_CONFIRM, sConfirm )
if gets
return( get_input )
endif
Return( NIL )