Category : BASIC Source Code
Archive   : PBWRITE.ZIP
Filename : PBWDEMO3.BAS

 
Output of file : PBWDEMO3.BAS contained in archive : PBWRITE.ZIP
$IF 0

PB-WRITE Simple demo #4
Data Entry Screen

$ENDIF

$COMPILE EXE
$OPTION GOSUB ON ' This is a MUST
DECLARE SUB GetStrLoc() 'we have to declare this because we need it

%FALSE = 0
%TRUE = NOT %FALSE

' These are the parameters that you need to pass to PBWRITE
REDIM Item$(32) ' field content
REDIM FieldName$(32) ' field name appears in window border
REDIM BoxTOP%(32) ' top of the editor window
REDIM BoxLEFT%(32) ' left of window
REDIM BoxBOTTOM%(32) ' bottom of window
REDIM BoxRIGHT%(32) ' right of window

' load the field names and positions

DO
INCR x
READ FieldName$(x)
IF FieldName$(x)="EOF" THEN EXIT DO
NumberofFields = x
READ BoxTOP%(x) ' top of the editor window
READ BoxLEFT%(x) ' left of window
READ BoxBOTTOM%(x) ' bottom of window
READ BoxRIGHT%(x) ' right of window
LOOP


TextAttribute% = &H78 ' Color of the text (bg=7, fg=8) grey on white
BorderAttribute% = &H7F ' Color of the border (bg=7, fg=F) hi-white on white
Margin% = 30 ' Right margin for word wrap <<<<<<<
ExitCode% = 0 ' returns the scancode of the exit key

' save the screen and cursor position

TEMP$ = SAVESCREEN$:X%=CSRLIN:Y%=POS(0)
' Create the background screen

$INCLUDE "FONTINIT.INC" ' Remark this out to prevent loading screen fonts
COLOR 0,1:CLS
Locate 1,1,0:color 0,3:PRINT "DEMO4: Using PBWrite as DATA ENTRY FIELDS. Press ENTER for next, ESC to go BACK";
LOCATE 25,1:PRINT " ALT-X to Quit [F5] ZOOM [F10] SAVE - All other editing keys are active. ";
LOCATE 1,1


' Initialize all windows
FOR x = 1 TO NumberOfFields
ExitCode% = 256 ' just draw window, don't edit

PBWRITE ITEM$(x),_ ' string to contain the field data
BoxTOP%(x),_ ' dimensions of the edit window
BoxLEFT%(x),_ '
BoxBOTTOM%(x),_ '
BoxRIGHT%(x),_ '
CursorRow%,_ ' default to 0, these contain the current -
CursorCol%,_ ' cursor and position within the document -
DocPointer%,_ ' allowing you to re-enter the subroutine -
DocOffset%,_ ' with the document state preserved.
FieldName$(x),_ ' This is just the default name for SAVE/LOAD
TextAttribute%,_ ' The color of the text
BorderAttribute%,_ ' The color of the border
Margin%,_ ' The Right Margin
ExitCode% ' key used to exit editor

Next x ' finished drawing the whole screen

' now edit the fields


x=1 ' start with the first field
DO

CursorRow% = 0 ' default to 0, these contain the current -
CursorCol% = 0 ' cursor and position within the document -
DocPointer% = 0 ' allowing you to re-enter the subroutine -
DocOffset% = 0 ' with the document state preserved.
ExitCode% = 13 ' exit on

PBWRITE ITEM$(x),_ ' string to contain the field data
BoxTOP%(x),_ ' dimensions of the edit window
BoxLEFT%(x),_ '
BoxBOTTOM%(x),_ '
BoxRIGHT%(x),_ '
CursorRow%,_ ' default to 0, these contain the current -
CursorCol%,_ ' cursor and position within the document -
DocPointer%,_ ' allowing you to re-enter the subroutine -
DocOffset%,_ ' with the document state preserved.
FieldName$(x),_ ' This is just the default name for SAVE/LOAD
TextAttribute%,_ ' The color of the text
BorderAttribute%,_ ' The color of the border
Margin%,_ ' The Right Margin
ExitCode% ' key used to exit editor

IF ExitCode% = 13 THEN INCR x:IF x > NumberOfFields THEN x = NumberOfFields
IF ExitCode% = 27 THEN DECR x:IF x = 0 THEN x = 1

IF ExitCode% = 68 or ExitCode% = 45 THEN EXIT DO

LOOP

IF ExitCode% = 68 THEN MESSAGE "SAVE THE ITEM$() ARRAY"
IF ExitCode% = 45 THEN MESSAGE "ABORT EDIT"

DELAY 4

' Restore the screen and cursor position
RESTORESCREEN TEMP$:LOCATE X%, Y%, 1 ' make sure cursor is visible
END
' =========================================================================
$INCLUDE "PBWRITE.BAS"

' =========================================================================
' DATA FIELDNAME TOP LFT BOT RGT
' ---- --------- --- --- --- ---
DATA NAME , 5 ,10 ,5 ,35
DATA ADDRESS , 7 ,15 ,7 ,40
DATA CITY , 9 ,20 ,9 ,45
DATA STATE , 11 ,25 ,11 ,32
DATA ZIP , 13 ,30 ,13 ,42
DATA PHONE , 15 ,35 ,15 ,55
DATA MEMO , 17 ,40 ,22 ,75

DATA EOF


  3 Responses to “Category : BASIC Source Code
Archive   : PBWRITE.ZIP
Filename : PBWDEMO3.BAS

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/