I have been programming in Visual Basic for a number of years, so the
derivative of BASIC used NS Basic was very familiar. BASIC is well
known for its gentle learning curve, and once you know one style of BASIC
you can become proficient in others quickly.
NS Basic Applications don't produce a complete self contained Palm Application
(PRC) when they compile. Just like Microsoft's Visual Basic, the
code produced when compiling is an intermediate form that is examined at
runtime. I like to think of it as apples turning into applesauce,
on its way to being apple juice. They require an 83K runtime PRC as well.
With many Pilots having 8 MBs of RAM, this isn't the big deal it once was.
Of course, all your NS Basic Apps use the same Runtime, so it's only installed
once. Separate from the runtime, NS Basic apps tend to be very small.
Having use Sun's KJava for Palm, I expected the NS Basic Applications
to run very slowly, however I was pleasantly surprised at their responsiveness.
For most data entry and reporting applications the speed is very near the
speed of the built in apps.
The hypothetical example below shows the code it would take to copy
a string from a database structure into a Text Field. As you can
see, NS Basic takes care of pretty much all the memory allocation and de-allocation,
as well as abstracting you from much of the Palm OS' distinctions between
non-movable handles to memory, and locked pointers.
MemHandleNew (StrLen (recordP.somestring)
p = MemHandleLock (h);
StrCopy (p, recordP.somestring);
fld = GetObjectPtr (fldSomeField);
FldSetTextHandle (fld, h);
Same code using NSBasic/Palm
Setting a Text field to a string from a database
User Interface – Forms and Buttons
Your form layout work will be done in NS Basic's combination code and form
designer development environment. The main window shows the Pilot's screen
layout on the left and the “project explorer” on the right. The editor
presents a Pilot's screen and a palette of controls to choose from.
You just click and drag lists, buttons, checkboxes and more from the palette
to design your forms.
My initial idea was to port (write again) my application, GlucoPilot,
from C to NS Basic. However, missing from the Palette was a Table
control. The folks as NS Basic said that Pilot Tables have a few
problems with them, and that makes it “hard to make it easy.” Their
goal with NS Basic was to make the environment as powerful as possible
without sacrificing ease of use, and tables did just that. I was
told they would be revisiting the issue soon, but for now I should redesign
my user interface given the available controls. GlucoPilot is a very
table-centric application, so I scrapped that idea, rather than re-design
it. I could have certainly replaced my table with a “master-detail”
style form, with a list at the top of the form, and controls at the bottom.
NS Basic is very well suited for these kinds of applications, and much
sample code is included.
Other than the tables issue, my only real complaint with the User Interface
editor was that the forms you design don't EXACTLY match the result.
They are close, but not down to the pixel. For most apps this won't
be a problem, but since the Pilot only has a 160x160 screen, sometimes
every pixel counts.
Figure 1: The NS Basic/Palm Desktop and the resulting
Dev Environ. & Conclusion >>