NS Basic/CE

This tour has screen shots from NS Basic being run on an HPC device. On a Pocket PC, the screens are reformatted for the diifferent screen size and user interface automatically.


The Edit View

After starting NS Basic/CE, you'll what looks like a standard text editing view. Into this, you'll type your program. Don't worry too much about getting the spacing right: there's a Format command to make things pretty.

Once you've got your program entered, tap RUN (or the icon of the running man in the titlebar, and your program will create the Output View and execute immediately.

If your program has an error, it will return to the Edit View and highlight the line of code where the error occurred.

There are a few tools to help you debug. The Continue command will bring up a list of functions and subroutines, letting you choose one to resume execution. Execute Code lets you type extra lines of code for immediate execution, without modifying your program. Show Variable will display the current value of any variable.



Overview is a feature that lets you move around your program quickly. It puts up an alphabetic list of all your functions and subroutines. Tap one, and the Edit View will scroll to that function or subroutine.



The Output View


Here, we'll show you some code snippets and the resulting output on the screen.

We will begin with everyone's favorite first program. This is as easy as it gets, anywhere.

Print "Hello World"



The inputBox function is a handy way to get input from the user. Here's how it looks - note that statements can be of any length.

selection=inputbox("Choose test number:" & chr(13) & "1. Attr" & chr(13) & "2. Dir" & chr(13) & "3. Get/Put" & chr(13) & "4. Line Write" & chr(13) & "5. Write/Read" & chr(13) & "9. End Program", "File System Demo")




One of the most important objects in NS Basic/CE is the PictureBox. With it, you can create buttons, graphics and display text and pictures. This screen showshot shows a number of these things going on. The name of the base Output View is output. You can add additional objects on top of the Output View.

output.scalemode=3 'set scaling to use pixels
output.drawpicture "\windows\startup.bmp",300,0
output.drawcircle 150,150,25
output.drawcircle 250,100,25
output.drawText "this is drawtext"
output.drawText "this is some more drawtext"

addObject "picturebox","pic",200,0,50,50 'create a button

sub pic_click 'respond to the button being clicked by moving it
print "pic click"
pic.move 1200,1200
end sub




There a number of built in dialogs for standard operations, such as color, font, save, select file and help. Here's how to select a font:

AddObject "Dialog"



One of the fanciest objects you can use is the Grid. It can be used to organise data in tabular form, such as a spreadsheet might. The cells are clickable and the values can be set from within your code.

addobject "grid","grid",0,0,215,150
grid.TextMatrix(0, 0) = "Kenny"
grid.TextMatrix(1, 0) = "Carmen"
grid.TextMatrix(2, 0) = "Kyle"
grid.TextMatrix(3, 0) = "Eric"



© NSB Corporation. All rights reserved.
Features and specifications subject to change.