home *** CD-ROM | disk | FTP | other *** search
- ; Script : SAMPLE.SC
- ; Description : Paradox sample application
-
-
- ; Begin by clearing any stray procedures and/or variables which
- ; may have been created in previous Paradox work.
- RELEASE VARS ALL
- RELEASE PROCS ALL
- ; Empty the desktop to make sure the workspace is in Main mode, revoke
- ; passwords in effect but cancelled, flush memory buffers, write changes
- ; to disk, and remove explicit table locks.
- ALTSPACE {Desktop} {Empty}
- ECHO NORMAL ; display the empty desktop
- ECHO OFF ; then turn echo off to freeze the screen display
-
- ; --------------------------------------------------------------------------
- ; Procedure : Main()
- ; Description :
- ; When a user plays the SAMPLE.SC script, the Main() procedure is called
- ; to start the application. The Main() procedure displays a simple
- ; "splash" screen describing the application, then displays the
- ; application's main menu. The user interacts with the main menu, and
- ; the Main() procedure performs appropriate actions based on the item
- ; selected from the menu.
- ; --------------------------------------------------------------------------
-
- PROC Main()
- PRIVATE MenuItemSelected,
- ExitApplication
-
- ; Draw a "splash" screen.
- ShowSplashScreen()
-
- ; Display and maintain the application's main menu
- DisplayMainMenu()
-
- ; Now that we've displayed the menu, we wait until the user makes a
- ; selection from the menu and process it accordingly. We repeat
- ; this process, executing the commands contained within the
- ; WHILE...ENDWHILE loop, until the user wants to exit the application.
- ; We use the logical variable ExitApplication as a signal to tell us
- ; when to exit the loop. Initially we assign the value False to
- ; ExitApplication so we'll enter the loop the first time through.
- ; Each time we return to the start of the WHILE loop to process
- ; another menu selection, we check the value of ExitApplication. If
- ; the value is still False we enter the loop once again, processing
- ; another menu selection. Otherwise, we exit the loop, executing
- ; the first statement following the ENDWHILE at the end of the loop.
- ; When the user selects Exit|Yes from the main menu, we assign the
- ; value True to the variable ExitApplication.
- ExitApplication = False
-
- WHILE (ExitApplication <> True)
-
- ; Grey out items which are not applicable from the main menu.
- GreyMainMenuItems()
-
- ; Wait for the user to select an item from the main menu. The menu
- ; was displayed by DisplayMainMenu().
-
- GETMENUSELECTION TO MenuItemSelected
-
- ; Examine the MenuItemSelected and execute the proper procedure or
- ; (in the case of Exit Selections) set the proper flag. Note that
- ; the string in the switch statement must be typed in EXACTLY as
- ; it is in the menu procedure itself, including case and spaces.
- SWITCH
- CASE (MenuItemSelected = "Exit/Yes") : ; user wants to exit
- ExitApplication = True
-
- CASE (MenuItemSelected = "Exit/No") : ; user has decided not to exit
- ExitApplication = False
-
- CASE (MenuItemSelected = "AltSpace/About") : ; user wants info about
- ; program
- DisplayAboutBox()
-
- CASE (MenuItemSelected = "Table/Modify") : ; user wants to modify
- LetUserModifyTable() ; the Invoice table
-
- CASE (MenuItemSelected = "Report/All") : ; user wants to create
- PrintAllRecords() ; a report on ALL
- ; customers
-
- CASE (MenuItemSelected = "Report/West Coast") : ; user wants to
- PrintWestCoastRecords() ; create a report
- ; on West Coast
- ; customers only.
-
- ENDSWITCH
-
- ENDWHILE
-
- ; Before we leave the program we explicitly remove the menu. CLEARPULLDOWN
- ; is not required here, but using the command is good programming
- ; practice.
- CLEARPULLDOWN
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : DisplayMainMenu()
- ; Description :
- ; Displays the main menu for the application. Note that the tags created
- ; in this procedure must be typed EXACTLY in the calling procedure for
- ; them to be processed properly.
- ; Called By : Main()
- ; --------------------------------------------------------------------------
-
- PROC DisplayMainMenu()
-
- ; Display the main pulldown menu.
- SHOWPULLDOWN
- "≡" : "Program Information." : "AltSpace"
- SUBMENU
- "Utilities" : "System Utilities" : "Utilities"
- SUBMENU
- "Calculator" : "Popup Calculator" : "Calculator",
- "Help Interval" : "Set AutoHelp Interval" : "Help Interval"
- ENDSUBMENU,
- SEPARATOR,
- "About" : "About this application." : "AltSpace/About"
- ENDSUBMENU,
- "Table" : "Work with the Invoice table." : "Table"
- SUBMENU
- "Modify" : "Modify Invoice table." : "Table/Modify",
- "Close" : "Close Invoice table." : "Table/Close"
- ENDSUBMENU,
- "Report" : "Report on Customer Table." : "Report"
- SUBMENU
- "All" : "Print report of all customers." :
- "Report/All",
- "West Coast" : "Print report of only West Coast customers" :
- "Report/West Coast"
- ENDSUBMENU,
- "Exit" : "Exit this application." : "Exit"
- SUBMENU
- "No" : "Do not exit application." : "Exit/No",
- "Yes" : "Exit this application." : "Exit/Yes"
- ENDSUBMENU
- ENDMENU
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : GreyMainMenuItems()
- ; Description : This procedure greys out (dims) menu items which are not
- ; applicable from the Main Menu. These items are no longer
- ; selectable from the menu.
- ; Called By : Main()
- ; --------------------------------------------------------------------------
-
- PROC GreyMainMenuItems()
-
- ; Disable items not available in the Sample application. The Utilities
- ; item is available only in the Advanced application. The Table/Close
- ; item is available only when a table is on the workspace.
- MENUDISABLE "Utilities"
- MENUDISABLE "Table/Close"
-
- ; Enable main menu selections
- MENUENABLE "Table/Modify"
- MENUENABLE "Report/All"
- MENUENABLE "Report/West Coast"
- MENUENABLE "Exit/No"
- MENUENABLE "Exit/Yes"
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : DisplayAboutBox()
- ; Description :
- ; Creates a simple dialog box displaying information about the
- ; application. It uses the SHOWDIALOG command to create the box
- ; with a single button which, when pressed, clears the box.
- ; Called by : Main(),
- ; --------------------------------------------------------------------------
-
- PROC DisplayAboutBox()
-
- ; Create a dialog box with the following dimensions...
- SHOWDIALOG "Sample Application"
- @ 5, 10
- HEIGHT 12
- WIDTH 60
-
- @ 1, 0 ?? FORMAT("W58,AC", "Sample Application")
- @ 3, 0 ?? FORMAT("W58,AC", "Paradox 4.0")
- @ 5, 0 ?? FORMAT("W58,AC", "Borland International")
-
-
- ; The following creates the single OK button at the noted
- ; coordinates. The "~" character assigns Alt-O as the button hot key.
- ; Because this is the only push button in the dialog box there
- ; is no need to analyze the results.
- PUSHBUTTON @ 8, 23
- WIDTH 12
- "~O~K"
- OK
- VALUE "OKButtonPressed"
- TAG "OKButton"
- TO OKButton
-
- ENDDIALOG
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : LetUserModifyTable()
- ; Description:
- ; Wait on table. Allow the user to work with the
- ; table until s/he presses Formkey, Do_It!, Del,
- ; Ctrl-T, or F10. F10 activates the SHOWPULLDOWN menu and
- ; temporarily suspends the WAIT until the menu interaction
- ; is complete.
- ; Called By : Main
- ; --------------------------------------------------------------------------
-
- PROC LetUserModifyTable()
-
- ; Place the Invoice table in CoEdit mode, pick the "F" form, and
- ; set the window conditions.
- COEDIT "Invoice"
-
- ; Move the table to a location where the user will not accidentally
- ; display it.
- WINDOW MOVE GETWINDOW() TO -100, -100
-
- PICKFORM "F"
-
- ; Get the handle of the form window.
- WINDOW HANDLE CURRENT TO InvoiceWindow
-
- ; Specify attributes of the form window in a dynamic array.
- DYNARRAY WindowAttributes[]
- WindowAttributes["HEIGHT"] = 21
- WindowAttributes["ORIGINROW"] = 1
- WindowAttributes["ORIGINCOL"] = 0
- WindowAttributes["CANMOVE"] = True
- WindowAttributes["CANRESIZE"] = True
- WindowAttributes["CANCLOSE"] = False
-
- ; Now apply these attributes to the form window
- WINDOW SETATTRIBUTES InvoiceWindow FROM WindowAttributes
-
- ; Enable/Disable menu selections.
- GreyModifyMenuItems()
-
- ; Wait on the workspace table. The prompt line is placed at the
- ; bottom of the screen, telling the users what shortcut keys are
- ; available.
- ; When an event is "trapped" by the wait, the procedure
- ; "ProcessWaitEvents" is called. This procedure acts as a handler,
- ; deciding what to do with the particular event. In turn
- ; a value of 0, 1, or 2 is returned to the wait.
- ; 0 - processes the event and proceeds to the next event in the
- ; trigger cycle.
- ; 1 - does NOT process the current event and breaks out of the
- ; trigger cycle, but does NOT break out of the wait.
- ; 2 - does NOT process the current event and breaks out of the
- ; trigger cycle AND the wait.
-
- PROMPT " [F2] Close │ [F10] Menu │ [Ctrl-T] Update Totals │" +
- " [Ctrl-L] Update Customer" ; set PROMPT
- MESSAGE "Press [F1] for lookup help in fields followed by *" ; and MESSAGE
- WAIT WORKSPACE
- PROC "ProcessWaitEvents" ; call the wait procedure when any of the
- ; specified events occurs. The procedure must
- ; return a 2 to break out of the wait.
-
- ; Trap the following keypresses. Note that we use numeric keycodes
- ; that are explained in the comment following the KEY statement.
- KEY -83, -60, 15, 20, -24, -18, -31, 26, -44, -97
- ; Del, Do_It!, Ctrl-O, Ctrl-T, Alt-O, Alt-E, Alt-S, Ctrl-Z, Alt-Z, Ctrl-F4
-
- ; Trap the following message event. If the user interacts with a
- ; SHOWPULLDOWN menu and either selects an item or presses a MenuKey,
- ; a MENUSELECT message will occur and the WAIT procedure will be
- ; called.
- MESSAGE "MENUSELECT"
- ENDWAIT
-
- PROMPT "" ; clear the PROMPT after leaving the WAIT
- DO_IT! ; close the edit session
- CLEARALL ; clear the table from the workspace.
-
- ; Because this is a sample application, we empty the Invoice and Orders
- ; tables so they can be used again.
- EMPTY "Invoice"
- EMPTY "Orders"
-
- ; ECHO NORMAL displays the empty workspace. ECHO OFF hides the
- ; workspace again but leaves the empty workspace displayed on the full
- ; screen canvas.
- ECHO NORMAL
- ECHO OFF
-
- ENDPROC
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : GreyModifyMenuItems()
- ; Description : This procedure greys out (dims) items on the SHOWPULLDOWN
- ; menu which are not available while the user is coediting
- ; the multi-table form. Greyed items cannot be selected
- ; from the menu.
- ; Called By : LetUserModifyTable()
- ; --------------------------------------------------------------------------
-
- PROC GreyModifyMenuItems()
-
- ; Disable the following menu items.
- MENUDISABLE "Table/Modify"
- MENUDISABLE "Report/All"
- MENUDISABLE "Report/West Coast"
- MENUDISABLE "Exit/No"
- MENUDISABLE "Exit/Yes"
-
- ; Enable the following menu item.
- MENUENABLE "Table/Close"
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : ProcessWaitEvents()
- ; Description :
- ; Proc is called when an event is triggered from the modify table wait.
- ; The procedure evaluates the kind of message and does the appropriate
- ; processing, then returns a value of 0, 1, or 2 to the wait (See
- ; LetUserModifyTable proc for details on the return values).
-
- ; Called By : LetUserModifyTable()
- ; --------------------------------------------------------------------------
-
- PROC ProcessWaitEvents(TriggerType, EventInfo, CycleNumber)
-
- ; The TriggerType argument is assigned a value based on the type of event
- ; or trigger that the procedure was called for. The dynamic array
- ; EventInfo contains information about the event which occurred during
- ; the wait. If the EventInfo element "Type" is "KEY", then we examine the
- ; element "KEYCODE" to determine the numeric keycode that the WAIT command
- ; trapped. For example, if the user pressed Ctrl-Z, the dynamic array will
- ; contain the following elements:
- ; Dynarray EventInfo[]
- ; EventInfo["TYPE"] = "KEY"
- ; EventInfo["KEYCODE"] = 26
-
- SWITCH
- CASE (EventInfo["TYPE"] = "KEY") :
-
- ; The following SWITCH...CASE...ENDSWITCH statement performs a
- ; series of tests to determine what key was pressed and what mode
- ; Paradox was in when the key was pressed.
- SWITCH
-
- ; The following CASE executes when the user presses the
- ; Delete key (Keycode -83). This CASE calls the custom "Confirm
- ; Delete" dialog box before deleting the invoice.
- ; Because the delete is processed in the DisplayDeleteBox()
- ; procedure, we return 1 to go back to the WAIT, deny the
- ; pending event, and cancel the current trigger cycle.
- CASE (EventInfo["KEYCODE"] = -83) : ; Del
- DisplayDeleteBox()
- RETURN 1
-
- ; The following CASE executes when the user presses the
- ; Do_It! F2 key. Each IF statement within this CASE tests
- ; to see what state Paradox was in when the F2 key was
- ; pressed, so the application can take the appropriate action.
- CASE (EventInfo["KEYCODE"] = -60) : ; Do_It!
-
- ; It is possible that the user was in Field View, and
- ; chose F2 to get out of Field View, not out of the
- ; current wait.
- IF (ISFIELDVIEW() = True)
- THEN RETURN 0
- ENDIF
-
- ; It's also possible the user was in LookupHelp, and
- ; pressed F2 to select a value from the lookup table.
- IF (HELPMODE() = "LookupHelp")
- THEN RETURN 0
- ENDIF
-
- ; It's possible the user was in CoEdit mode. We can't
- ; leave CoEdit if the field data is invalid (e.g.
- ; invalid date or incomplete picture). Before we
- ; leave, we want to make sure that the value in
- ; the current field is valid.
- IF (ISVALID() <> True)
- THEN RETURN 0
- ENDIF
-
- ; If the record passes the previous validity test,
- ; we execute a Do_It! to try to post the record.
- ; The following IF statement then evaluates the mode
- ; the system is in. If the system is in Main mode, the
- ; Do_It! was successful and we terminate the WAIT
- ; with a RETURN 2.
- Do_It!
- IF (SYSMODE() = "Main")
- THEN RETURN 2 ; exit the WAIT
- ENDIF
-
- ; If the Do_It! does not put the system in Main mode
- ; and terminate the WAIT, a key violation exists. We then
- ; issue an ECHO NORMAL to display the desktop to the user,
- ; issue a Do_It! again so Paradox displays the KeyViol
- ; message to the user, and RETURN 1 to go back to the
- ; WAIT to let the user resolve the KeyViol.
- ECHO NORMAL
- Do_It!
- RETURN 1 ; couldn't leave CoEdit, let user resolve KeyViol
-
- ; The following CASE executes when the user presses the
- ; Ctrl-T Total key (Keycode 20). This CASE calls the proc
- ; that totals the order lines.
- CASE (EventInfo["KEYCODE"] = 20) : ; Ctrl-T (Total)
- CalculateOrderTotal()
- RETURN 1
-
- ; The following CASE executes when the user presses
- ; Ctrl-O or Alt-O. This CASE denies the event so the user
- ; doesn't inadvertently shell to DOS.
- CASE (EventInfo["KEYCODE"] = 15) OR ; Dos
- (EventInfo["KEYCODE"] = -24) : ; DosBig
- ; Stay within the wait but don't process any more
- ; events in the current cycle.
- RETURN 1
-
- OTHERWISE:
- SOUND 400 100 ; issue a beep in other situations
- RETURN 1
-
- ENDSWITCH
-
- ; If the EventInfo["MESSAGE"] element is "MENUSELECT", then the user
- ; has chosen from the menu.
- CASE (EventInfo["MESSAGE"] = "MENUSELECT") :
-
- ; The following SWITCH...CASE...ENDSWITCH statement performs a
- ; series of tests to determine what the user chose from the menu.
- SWITCH
-
- ; The following CASE executes when the user chooses ≡|About.
- ; This CASE calls a proc to display a dialog box containing
- ; information about the application. It then returns 0 to
- ; go back to the WAIT.
- CASE (EventInfo["MENUTAG"] = "AltSpace/About") :
- DisplayAboutBox()
- RETURN 0
-
- ; The following CASE executes when the user chooses
- ; Table|Close. The IF statement tests to see if the user is
- ; in Field View (in the Shipping instructions memo) and closes
- ; the memo, if necessary.
- CASE (EventInfo["MENUTAG"] = "Table/Close") :
- IF (ISFIELDVIEW() = True) ; if the user is in Field View
- THEN Do_It! ; save the memo and close it
- ENDIF
-
- ; We execute a Do_It! to try to post the record.
- ; The following IF statement then evaluates the mode
- ; the system is in. If the system is in Main mode, the
- ; Do_It! was successful and we terminate the WAIT
- ; with a RETURN 2.
- Do_It!
- IF (SYSMODE() = "Main")
- THEN RETURN 2 ; exit the WAIT
- ENDIF
-
- ; If the Do_It! does not put the system in Main mode
- ; and terminate the WAIT, a key violation exists. We then
- ; issue an ECHO NORMAL to display the desktop to the user,
- ; issue a Do_It! again so Paradox displays the KeyViol
- ; message to the user, and RETURN 1 to go back to the
- ; WAIT to let the user resolve the KeyViol.
- ECHO NORMAL
- Do_It!
- RETURN 1 ; couldn't leave CoEdit, let user resolve problem
-
- OTHERWISE:
- SOUND 400 100
- RETURN 1
-
- ENDSWITCH
-
- ; This is the proc's safety valve. If the wait sends a message
- ; we haven't planned on, then beep, process any further events
- ; in the cycle, and remain within the wait.
- OTHERWISE :
- SOUND 400 100
- RETURN 1 ; for safety, ignore events we don't recognize
-
- ENDSWITCH
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : DisplayDeleteBox()
- ; Description :
- ; Brings up a dialog box prompting the user to confirm that s/he
- ; wants to Delete the record. If the user chooses Ok, then we
- ; can go ahead and delete the user. If not, then just return.
- ; Called By : ProcessWaitEvents()
- ; --------------------------------------------------------------------------
-
- PROC DisplayDeleteBox()
-
- ; Define the "Delete" dialog box.
- SHOWDIALOG "Delete Record"
- @ 6, 10
- HEIGHT 7
- WIDTH 54
-
- ; Text within the box itself.
- @ 1, 4 ?? "Are you sure you want to delete this record?"
-
- PUSHBUTTON @ 3, 30 WIDTH 12
- "~C~ancel"
- CANCEL
- VALUE "CancelButton"
- TAG "Cancel"
- TO CancelButton
-
- ; Place the OK and CANCEL buttons.
- PUSHBUTTON @ 3, 11 WIDTH 12
- "~O~K"
- OK
- VALUE "OK"
- TAG "OKButton"
- TO OKButton
-
- ENDDIALOG
-
- ; If the user accepted the dialog, then we go ahead and delete
- ; this Invoice record. We then issue an ECHO NORMAL so the user
- ; can see Paradox display the Delete message.
- IF (RetVal = True)
- THEN ECHO NORMAL
- Del
- ENDIF
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : CalculateOrderTotal()
- ; Description:
- ; When the user presses Ctrl-T, the line items are totaled and added
- ; to the relevent order fields to create an Invoice total.
- ; Called By : ProcessWaitEvents()
- ; --------------------------------------------------------------------------
-
- PROC CalculateOrderTotal()
- PRIVATE LineTotal
-
- ; initialize the line item amount
- LineTotal = 0
-
- ; If we're not on the Invoice table, then inform the user that Order
- ; totalling can only occur from there.
- IF (TABLE() <> "Invoice")
- THEN BEEP
- MESSAGE "You must be in the Invoice table to calculate totals"
- SLEEP 2500 ; pause to display message
- MESSAGE "" ; clear the message
- RETURN
- ENDIF
-
- ; we can subtotal the line items. Move to the Orders table.
- MOVETO "Orders"
-
- ; calculate the extended price for each item number ordered,
- ; and accumulate the running line total in the LineTotal variable.
- SCAN
- IF ((ISBLANK([Quantity]) = False) AND ; only update totals for
- (ISBLANK([Item_No.]) = False)) ; records with qty and item
- THEN [Amount] = ROUND([Unit_Price] * [Quantity], 2)
- LineTotal = ROUND(LineTotal + [Amount], 2)
- ENDIF
- ENDSCAN
-
- ; Now we need to update the Invoice totalling fields
- MOVETO "Invoice"
- [Subtotal] = LineTotal ; update subtotal
- IF (ISBLANK([Discount_%]) = True) ; discount amount
- THEN [Discount_%] = 0
- ENDIF
- [Discount] = ROUND([Subtotal] * [Discount_%] / 100, 2)
- IF (ISBLANK([Tax_%]) = True)
- THEN [Tax_%] = 0
- ENDIF
- [Tax] = ROUND(([Subtotal] - [Discount]) * [Tax_%] / 100, 2) ; Tax Amount
- IF (ISBLANK([Shipping]) = True)
- THEN [Shipping] = 0
- ENDIF
- [Total] = ([Subtotal] - [Discount]) + [Tax] + [Shipping] ; Order Total
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : PrintAllRecords()
- ; Description:
- ; The user wants to print a report on all Customer records. This
- ; proc checks that the printer is ready and, if it is, then plays
- ; a "pre-recorded" script to send the report to the printer.
- ; Called By : Main()
- ; --------------------------------------------------------------------------
-
- PROC PrintAllRecords()
-
- ; Call the procedure IsPrinterReady() to check if a printer is on-line
- ; and ready to receive the report. The IsPrinterReady() procedure returns
- ; logical TRUE if the printer is ready and logical FALSE if it is not
- ; ready. If the printer is not ready, then the PrintAllRecords()
- ; procedure returns.
- IF (IsPrinterReady() = False)
- THEN RETURN
- ENDIF
-
- ; Open the currently set printer device for output. This command is
- ; useful when working on a network.
- OPEN PRINTER
- ; RptAll.sc is a recorded script for printing the standard report
- ; on the customer table.
- Play "RptAll"
-
- ; Close the currently opened printer.
- CLOSE PRINTER
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : PrintWestCoastRecords()
- ; Description:
- ; We only want West Coast, so we'll bring up a query save
- ; we've previously done, run it, and copy the report to the answer
- ; table, then print the report.
- ; Called By : Main()
- ; --------------------------------------------------------------------------
-
- PROC PrintWestCoastRecords()
-
- ; Make sure that the printer is ready to receive information.
- IF (IsPrinterReady() = False)
- THEN RETURN
- ENDIF
-
- ; Open the Printer
- OPEN PRINTER
-
- ; The following query was created interactively and saved using
- ; QuerySave. It was then copied into our script.
- Query
-
- Customer | Customer_No. | Last_Name | First_Name | Address | City |
- | Check | Check | Check | Check | Check |
-
- Customer | State/Prov. | Postal_Code | Telephone | Discount_% |
- | Check | Check 9.. | Check | Check |
-
- Endquery
-
- ; remember that the saved query ONLY places the query on the workspace.
- ; It is still up to the programmer to execute the Do_It! which will run
- ; the query...
- Do_It!
-
- ; the following can be produced by using ScriptRecord
- ;Menu {Tools} {Copy} {Report} {DifferentTable}
- ; {Customer} {R} {Answer} {R}
- ;Menu {Report} {Output} {Answer} {R} {Printer}
- ; But this can be done with PAL commands, and much more concisely.
- COPYREPORT "Customer" "R" "Answer" "R"
- REPORT "Answer" "R"
-
- ; close the printer
- CLOSE PRINTER
-
- CLEARALL ; to clear query image and answer table
-
- ENDPROC
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : ShowSplashScreen
- ; Description:
- ; Creates a window showing the application's "splash" screen.
- ;
- ; Called By : Main()
- ; --------------------------------------------------------------------------
-
- PROC ShowSplashScreen()
-
- ; define the display attributes of the splash screen window
- DYNARRAY WindowAttributes[]
- WindowAttributes["ORIGINROW"] = 7
- WindowAttributes["ORIGINCOL"] = 13
- WindowAttributes["WIDTH"] = 56
- WindowAttributes["HEIGHT"] = 11
- WindowAttributes["STYLE"] = 30 ; yellow on blue
- WindowAttributes["HASFRAME"] = False ; creates a frameless window
- WindowAttributes["FLOATING"] = True ; sets the window "above" the
- ; echo layer
-
- ; show the splash screen window
- WINDOW CREATE ATTRIBUTES WindowAttributes TO SplashWindow
-
- ; paint information inside the splash screen window
- @ 2,0 ?? FORMAT("W56,AC", "B O R L A N D")
- @ 3,0 ?? FORMAT("W56,AC", "Sample Application")
-
-
- ; pause to show the window
- SLEEP 2500
-
- ; close the window
- WINDOW CLOSE
-
- ENDPROC
-
-
-
- ; --------------------------------------------------------------------------
- ; Procedure : IsPrinterReady
- ; Description :
- ; Checks to see if the printer is ready.
- ; Called By : PrintAllRecords, PrintWestCoastRecords
- ; --------------------------------------------------------------------------
-
- PROC IsPrinterReady()
-
- ; check that the printer is ready
- ; give user a message that we're checking the printer
- Message "Checking printer status..."
-
- ; PRINTERSTATUS() returns a value of True if the printer is ready,
- ; False otherwise.
- IF (PRINTERSTATUS() <> True)
- THEN BEEP
- MESSAGE "Printer is not ready"
- SLEEP 2500 ; pause to display message
- MESSAGE "" ; remove message
- ; Tell the calling procedure NOT to continue sending the report.
- RETURN False
- ENDIF
-
- MESSAGE "" ; remove "Checking..." message
-
- ; Tell the calling procedure that the printer is ready to receive
- ; report data.
- RETURN True
-
- ENDPROC
-
-
- ; The Main Event
- ; ----------------------------------
- ; The following line calls the Main() procedure. The Main() procedure
- ; starts the Sample application.
- Main()
-
- ; Clean Up
- ; ----------------------------------
- ; We're done. Close any open images and release any variables and procedures
- ; before we exit.
- RESET
- RELEASE PROCS ALL
- RELEASE VARS ALL
-