11.04.2013 Views

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Examples<br />

The following example is taken from the sample program in Appendix A, “Sample<br />

Program,” in Developing <strong>UniBasic</strong> Applications. Notice that the DISPLAY<br />

command is combined with the <strong>UniBasic</strong> @ function to clear the screen and display<br />

messages. Then INPUT @ accepts the user’s response (a corrected price).<br />

ALTER_RECORD:<br />

* Create a new screen, and allow PRICE and ADDRESS to be changed.<br />

* Initialize variables and draw the screen<br />

NEED.TO.WRITE = 0<br />

DISPLAY @(-1):@(15,5):"Alter ORDER":<br />

DISPLAY @(10,8):"(Press RETURN to leave un-changed)"<br />

DISPLAY @(8,9):"Old Price":@(42,9):"New Price (Enter 2 decimal<br />

places)"<br />

* Change the PRICE field (if desired)<br />

FOR ENTRY = 1 TO NUM_ENTRIES<br />

NEW.PRICE = ""<br />

DISPLAY @(10,9+ENTRY):OCONV(ORDER.REC,"MR2$,"):<br />

INPUT @(45,9+ENTRY):NEW.PRICE<br />

Later in the same sample program, the @ function is again combined with DISPLAY<br />

to paint the screen with prompts. After all prompts have been displayed, INPUT @<br />

returns the cursor to the end of the first line, accepting input on that line before<br />

moving to the end of the next. In this manner, it accepts input at the end of each line<br />

in turn.<br />

* Display the current ADDRESS information<br />

DISPLAY @(21,12):"Change Address to: ":<br />

DISPLAY @(21,13):"Street Line1: ":@(40,13):ADDRESS<br />

DISPLAY @(21,14):"Street Line2:"<br />

DISPLAY<br />

@(40,14):ADDRESS:@(21,15):"City:":@(40,15):CLIENT.REC<br />

DISPLAY @(21,16):"State:":<br />

DISPLAY<br />

@(40,16):CLIENT.REC:@(21,17):"Zip:":@(40,17):CLIENT.REC<br />

* Accept INPUT to change values of address<br />

INPUT @(40,13):STREET1<br />

IF STREET1 = '' THEN STREET1 = CLIENT.REC<br />

INPUT @(40,14):STREET2<br />

IF STREET2 = '' THEN STREET2 = CLIENT.REC<br />

INPUT @(40,15):CITY<br />

IF CITY = '' THEN CITY = CLIENT.REC<br />

INPUT @(40,16):STATE<br />

IF STATE = '' THEN STATE = CLIENT.REC<br />

INPUT @(40,17):ZIP<br />

IF ZIP = '' THEN ZIP = CLIENT.REC<br />

INPUT @ 1-388

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!