home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
text
/
ncclib.zip
/
NCCDEMO.ZIP
/
G_DATA.PRG
< prev
next >
Wrap
Text File
|
1992-10-21
|
5KB
|
159 lines
//═══════════════════════════════════════════════════════╕
// Program .....: G_Data │
// CopyRight ...: 1992 National Computer Consultants │
// All rights are reserved. │
// Author ......: Greg Rice │
//═══════════════════════════════════════════════════════╛
#include "inkey.ch"
#include "dbstruct.ch"
#define BUFFER 250
#define CRLF Chr(13) + chr(10)
Function g_DataClose()
dbCloseArea()
WinFilename( , "" )
WinIndexfiles( , {""} )
WinViewFields( , {""} )
WinViewStru( , {""} )
ShowBackGround()
OpenDesktop()
Return( NIL )
Function g_DataOpen()
local GetList := {} , ;
xFile := "*.DBF" + space(13) , ;
sCursor := Set(_SET_CURSOR) , ;
nWorkArea := Current_Window() , ;
sColor := SetColor() , ;
cScreen := savescreen() , ;
scrn := savescreen(maxrow()-5,03,maxrow(),79) , ;
Mouse := MouseSys() , ;
nPos := 0 , ;
i
for i = 1 to len(windows())
if empty(alias(i))
nWorkArea := i
exit
endif
next
SetColor( popup_color() )
WinBox(maxrow()-5,03,maxrow()-2,30,0,4,.t.)
@ maxrow()-4,04 say 'Open Database Window #' get nWorkArea pict '#'
@ maxrow()-3,04 say 'File:' get xFile picture '@KS25'
Set Cursor On
Read
Set( _SET_CURSOR, sCursor )
Setcolor( sColor )
if lastkey() # K_ESC
if nWorkArea > 0 .and. nWorkArea < 10
While "?" $ xFile .or. "*" $ xFile
setcolor( popup_color() )
xFile := DirPick( xFile,,44 )
SetColor( sColor )
Enddo
xFile := ltrim(trim(xFile))
nPos := Rat( ".", xFile )
if select(Substr(xFile,1,nPos-1)) != 0
SetColor( "W+/R" )
WinBox(9,19,15,62,,5,.t.)
@ 11,22 say 'This file is already open in a window.'
@ 13,24 say 'Click the mouse or press any key'
Mouse:ClearButtons()
Mouse:Show()
While Mouse:Button == 0 .and. Mouse:Ascii == 0
Mouse:Update()
Enddo
Mouse:Hide()
SetColor( sColor )
restscreen(,,,,cScreen)
Return( NIL )
endif
if File( xFile ) .or. File( xFile + '.DBF' )
Sele (nWorkArea)
dbCloseArea()
WinFilename(nWorkArea , "" )
WinIndexfiles(nWorkArea , {""} )
WinViewFields(nWorkArea , {""} )
WinViewStru(nWorkArea , {""} )
Sele (nWorkArea)
if ffshare( xFile )
WinFilename(nWorkArea , uppe(ltrim(trim(xFile))) )
WinViewFields(nWorkArea , stru_load(dbstruct()) )
WinViewStru( nWorkArea, dbstruct() )
Window_Active( .t. )
Current_Window( nWorkArea )
endif
elseif ! lastkey() == K_ESC
NccMesg( 'File not Found... Press any key', 24, 'center')
Mouse:ClearButtons()
Mouse:Show()
While Mouse:Button == 0 .and. Mouse:Ascii == 0
Mouse:Update()
Enddo
Mouse:Hide()
endif
endif
endif
SetColor( sColor )
restscreen(maxrow()-5,03,maxrow(),79,scrn)
Return( NIL )
Function g_DispStru()
local xh := setcolor(), scrn := savescreen(), n := {}, xTop
AEVAL(dbstruct(),{ |fi_stru| aadd(n,space(1)+;
padr(fi_stru[DBS_NAME],10,' ')+ ;
space(5)+fi_stru[DBS_TYPE]+space(5)+;
str(fi_stru[DBS_LEN],3)+space(5)+ ;
str(fi_stru[DBS_DEC],3)+' ') })
setColor( popup_color() )
xTop := int(((maxrow()/2) - 4 ))
arraydsp( n, ;
'Fieldname Type Len Dec', ;
'File Structure' ;
,xTop,21,xTop+09,55, ;
0, ;
0, ;
.t., ;
, ;
{ |o| dView_MouseReader(o,xTop,21,xTop+09,55) ;
} ;
)
restscreen(,,,,scrn)
setcolor( xh )
Return( NIL )