NS Basic/Palm Enhancements January 27, 2009 © NS BASIC Corporation. All rights reserved. |
The new properties are:
Gradient Color1: The top (or left) color.
Gradient Color2: The bottom (or right) color
Gradient Style: 1 for top to bottom, 0 for left to right.
You can use a bitmap instead of a label of the same size. Since Bitmap objects can have a script (just like a Button object), BitMap object buttons work the same way as Button Object buttons - but there are more options on appearance.
Gradients work best on devices which support 16 bit color, with screens at least 320x320 in size. For devices which are 160x160, you will need to click on the border of the Design Screen so it switches to its smaller size, so the bitmaps can be created properly.
Note that captions and gradients only apply to Bitmap objects. Label and CommandButton objects will continue to use the installed fonts and cannot have gradients.
Sizing images on Bitmaps: You can now specify the image to appear on a bitmap as well as its size. The new properties are:
Picture: The pathname to the image. It can be bmp, gif, jpg and other format.
Stretch: If False, the image will be the size of the orginal image, aligned at the top left. If the image if larger than the bitmap object, it will be clipped. If Stretch is True, the image will be scaled to fit the current size of the bitmap object.
Keep in mind that the maximum size of a bitmap is 65,512 bytes. The formula for calculating the size of a bitmap is (width * height) * 8.
Projects with existing bitmap objects will continue to work as before.
To edit a theme or to create a new one, start the IDE and open a project. Select the Theme Editor under the Tools menu. It will automatically open the theme for the current form for editing, but allows you to also modify other themes or create new ones.
Projects are automatically given the "Classic" theme. There is no restriction on changing the theme of an existing program.
The theme you specify in Project Properties will be automatically be added as a resource to your project. If you use additional themes, you have to add them as resources. Themes are kept in c:\NSBasic\Themes. You can put additional themes you create in that folder or elsewhere. If you update a theme on your desktop, it will not change on the device until you manually delete the old theme on the device.
Enhancements and Fixes in 6.1.0
Enhancements and Fixes in 6.0.3
Enhancements and Fixes in 6.0.2
Enhancements and Fixes in 6.0.1
Enhancements and Fixes in 6.0.0
Starting with the Treo, Palm added Navigation features to many of its devices. Using the 5 way control, a user can tab from field to field on a form. NS Basic/Palm allows you to control how this tabbing works.
Navigation is controlled by properties of the form and of objects that support navigation. Don't worry about running programs on devices without navigation: the navigation info is simply ignored.
If you do not set up any Navigation information, it will still work. The default tab order is used, where the left and right five way buttons move through the objects in the order that they are created. You can change this order by right clicking on the form name in the Project Explorer.
Interaction Mode vs. Navigation Mode
More complex objects need to "take over" the scroll keys in order to interact with them. For example, a text field needs to allocate all four scroll keys to move the cursor. Similarly, a pop-up list needs to use up and down to change the selection in the list. This conflicts with the requirement of using the scroll keys to navigate between objects. As a result, these complex objects need to have an interaction mode, where they can take over control of the keys. The opposite of interaction mode is navigation mode, where scroll keys navigate between objects. On a system with one-handed navigation, pressing "center" toggles between interaction mode and navigation mode. Finally, a subset of interaction mode is edit mode, which refers specifically to text fields.
Object Focus Mode vs. Application Focus Mode
Interaction mode and Navigation mode are Palm.com concepts. Access (formerly PalmSource, Inc) has defined application focus mode and object focus mode. Application focus mode refers to applications that do not have keyboard navigation enabled. In this state, up and down act as page up and page down in the traditional method that Palm OS implemented in its original form. Object focus mode refers to the state where individual objects on the screen can receive focus, essentially what "navigation mode" refers to above. Applications may or may not be able to toggle between application focus and object focus modes.
Form Navigation Properties
Object Navigation Properties
Additional Notes on Navigation
Grafitti Shift Indicator and Bitmap cannot be navigated to. Label and Scrollbar are always skipped. If you navigate to slider, the arrows on the five way control the slider and do not tab.
See the NavDemo.prj sample for more information.
Modal forms do not have to be full screen - in fact, they should be no taller than necessary. Since they have a border, they look best if they are positioned 4 pixels from the left with a width of 154. They are usually positioned at the bottom of a screen. There is usually a Done button to close the form.
To make a form modal, set its Modal property to True. Enter whatever tips you want to show in the Tips property. The Tips property can be wider than the property box allows, but cannot contain any return characters.
See the ModalForms.prj sample for more.
Read more about modal forms on Palmsource's website here: http://www.palmos.com/dev/support/docs/ui/UI_Forms.html
PDB Creator Pro features:
Enhancements and Fixes in 5.0.5
Enhancements and Fixes in 5.0.4
Enhancements and Fixes in 5.0.3
Enhancements and Fixes in 5.0.4
Enhancements and Fixes in 5.0.3
Enhancements and Fixes in 5.0.2
To set a timer, do the following statement:
SysInfoSet("Timer", 3000) 'Set a timer for 3 seconds later.
To respond to the Timer event in your program, use something like this in your Events script:
If getEevent()=nsbTimer then MsgBox "Timer Event Received" 'respond to event SysInfoSet("Timer", 3000) 'set up another timer End IfTo cancel a timer currently in effect, do SysInfoSet("Timer", 0). If you exit your program, the timer is cancelled. There is no need to do SetEventHandled for this event. See the Timer sample to try this out.
Enhancements and Fixes in 5.0.1
Enhancements and Fixes in 5.0.0
2-6. We've updated to a new version of the control we use for code windows. This gives a quite a few new capabilities. NS Basic/Palm programmers do not need to do anything to take advantage of these: they come automatically. There are actually a ton of new features that are not documented: explore some of the options when you right click in the control to see them all.
8. The Left, Top, Height and Width properties used to be design only. You can now modify them at runtime to move objects on the screen or to resize them.
9. The new Slider control brings up a standard Palm OS horizontal slider. See the Language Reference under the Help menu for complete documentation.
10. Shared Libraries and SysTrap functions now take byte arrays as arguments. This will allow you to get around many of the old restrictions on structures and strings with embedded nulls being passed. Each element of the byte array sends one byte to the function being called. If the array is of type Short, each element sends two bytes to the function.
'Example of array in SysTrapFunction 'Read in the date Dim dt(7) as Short Dim s as Integer s = SysTrapFunc(245, 0) ' TimGetSeconds SysTrapSub 252, 2, s, dt ' TimSecondsToDateTime MsgBox str(dt(4)) MsgBox str(dt(5))
20. Grid.FontMatrix(row, col) = FontNumber allows you to set the font of any cell in a grid. The values for FontNumber are typically 0 to 7, as shown in section 10.A of the Handbook. If you're using a tall font, you can adjust the row height.
Enhancements and Fixes in 4.4.2
Enhancements and Fixes in 4.4.1
Enhancements and Fixes in 4.4.0
Enhancements and Fixes in 4.3.1
Enhancements and Fixes in 4.3.0
Enhancements and Fixes in 4.2.1
Enhancements and Fixes in 4.2.0
Enhancements and Fixes in 4.1.5
Enhancements and Fixes in 4.1.4
Enhancements and Fixes in 4.1.3
Documentation for 4.1.3
The PlaySound statement allows you to play short pre recorded sounds in your program. It can only be used on Palm OS 5.0 and later. The format of the function is:
PlaySound(resource#, ampScale, flags)resource# is the resource number in your project. The sound must be in wav format and be less that 64k. Test the sounds on the device you want to use carefully: 16 bit mono, 8khz PCM encoded sound seems to work well. Add sounds to your project by doing "Add Resource", then setting the Type of the resource to 'wave'.
Enhancements and Fixes in 4.1.2
Enhancements and Fixes in 4.1.1
Enhancements and Fixes in 4.1.0
1. For detailed information on the enhanced Shared Library support, see Tech Note 5d. For a Tutorial, see Tech Note 5e.
2. Pocket Purchase is a plug in for NS Basic apps that makes it easy to sell your app. It adds a "Buy It Now" feature to your application that collects credit card information from the customer, transmits it to Pocket Purchase, securely, and registers your app. Pocket Purchase, Inc. with then send you a check. For more information on Pocket Purchase, see Tech Note 28.
3. Pa1m0ne Device Events: Various Zire and Tungsten devices have some soft buttons in the Grafitti area and a Five way selector. These can now be trapped as events. You can detect an event for a Pa1m0ne device by checking for GetEventType()=7 in your Event script. Then, call GetKey to see what the specific event is. Note that these values have changed since NS Basic/Palm 3.1.1 to better capture the events. The new T3 devices were creating conflicts with the values we had. The values in this table are based on tests run on different devices. They may differ from device to device. Pa1m0ne have not published the values.
WARNING: These values had to change in 4.0.0, since new devices were creating the same codes for new buttons as existing ones.
Button | GetEventType() | Asc(getKey()) |
---|---|---|
5 way released | 7 | 200 |
Left (5 way select) | 7 | 204 |
right (5 way select) | 7 | 208 |
select (5 way select) | 7 | 216 |
Alpha Keyboard | 7 | 13 |
Numeric Keyboard | 7 | 14 |
Contrast | 7 | 11 |
silk screen clock | 7 | 0 |
Virtual Clock | 7 | 1 |
Brightness | 7 | 13 |
Camera shutter button | 7 | 8 |
Close T3 Case | 7 | 4 |
Open T3 Case | 7 | 5 |
Soft Grafitti Area 1 | 7 | 15 |
Soft Grafitti Area 2 | 7 | 16 |
Soft Grafitti Area 3 | 7 | 17 |
Soft Grafitti Area 4 | 7 | 18 |
4. PopUpDate on T3 devices: On returning from PopUpDate calls, the results of DRAW* statements will not be refreshed. This is something that the Palm OS used to handle, but according to PalmSource, is now the responsibility of the calling app.
5. SysInfo(9) Referred to as KeyDownEvent.chr in the Palm OS documention. This is the character code that caused the event. This could be any of the regular keyboard characters, a soft or hard button on the device or other event. Devices from different manufacturers will have special chr values. For example, PalmOne has special events in the 1280 to 3925 range. Values should be described in files in the SDK from the hardware manufacturer (i.e. PalmChars.h).
SysInfo(10) Referred to as KeyDownEvent.keyCode in the Palm OS documention. It is used to contain additional information about the chr. For example, the Palm 5-Way button uses this value to tell if the event is up, down, left or right.
SysInfo(11) Referred to as KeyDownEvent.modifiers in the Palm OS documention. Flags are defined in SysEvent.h. You will need to test the bits of this value to check is a flag is set. For example, 0x0008 being set mean the 'commandKeyMask' bit is set and the chr received is a command, not a character.
Programs can be tested using POSE, the Palm Simulator or an actual device.
If you have Define statements in your current code, don't worry: they will simply be ignored. Important: Do not rename the Project_startup() code to another name.
There are now 3 ways to refer to a property of an object
Field1.text 'As before
varname.text 'variable reference
controls(0).text 'positional
See the new "Controls" sample for more.
NOTE: For bitmaps, the show and hide methods only work the first way.
Before, if you overwrote an existing record, the data written for a string field would match the length of the original string. Now, only the new length is written, and the record is shortened if the new field is shorter or lengthened if the new string field is longer than the old record field.
The old way always ended up with an extra null character at the end of a record. The new way does not end with an extra null character. The length of a record will be the sum of the length of the data fields written (this includes a terminating null character at the end of each string field).
1. The Handbook says the Bluetooth port is 'rcfm'. It is 'rfcm'.
2. Tungsten: Palm's new Tungsten devices have a new button with a top, left, bottom and select (in the middle). These buttons all will generate repeated events if held down.
Top and Bottom send the same codes as on any Palm OS device, however on devices with the 5Way button, they generate an extra event when they are released. GetEventType will return nsbPalm5Way with getkey() of 0 when any of the buttons are released.
Left, Right and Select will generate a GetEventType() of nsbPalm5Way with a getKey value of 4,8 or 16 respectively. Like Top and Bottom, these are followed by an extra event when released.
Button | GetEventType() | Asc(getKey()) |
---|---|---|
5 way released | 7 | 0 |
Left (5 way select) | 7 | 4 |
right (5 way select) | 7 | 8 |
select (5 way select) | 7 | 16 |
Alpha Keyboard | 7 | 29 |
Numeric Keyboard | 7 | 30 |
Contrast | 7 | 31 |
silk screen clock | 7 | 32 |
Virtual Clock | 7 | 33 |
Brightness | 7 | 34 |
Camera shutter button | 7 | 40 |
Enhancements and Fixes in 3.1.1
1. SysInfo(8) function returns the number of Kbytes of storage heap the remaings. Your app should check this before starting anything that needs a significant amount of additional storage to complete.
Example:
If sysinfo(8)<2 then 'we want to make sure at least 2k is free msgbox "Operation could not be performed. Your device is low on memory" Else ... go ahead and process as usual End if
NS Basic/Palm 2 is a major upgrade to the NS Basic development environment. Almost every aspect of it has been reconsidered and improved.
Probably the single most important enhancement is that multiple code windows can be opened at the same time. You can also customize the look by hiding information that used to appear. The Properties windows has been changed to look like the properties windows of most IDEs.
No change has been made to NSBRuntime, other than the version number. There are no changes to the syntax of the languge.
Enhancements and Changes in 2.0.0
Enhancements and Fixes in 2.1.1
IDE
Property Window
Code Window
Project Explorer
Menu Editor
Bitmaps and Icons
Palm Screen
Run
Shared Libraries
Other
Backwards Compatibility
After saving a project using NS Basic 2.0, you will not be able to open it again under 1.12. However, using the Notepad, it is possible to modify a .prj file saved under 2.0 so it can be opened under 1.12 again. Here is what to do:
NS Basic 2.0 is able to load NS Basic 1.12 projects without any changes.
Enhancements and Fixes in 2.1.0
Enhancements and Fixes in 2.0.5
Enhancements and Fixes in 2.0.4
Enhancements and Fixes in 2.0.3
Enhancements and Fixes in 2.0.2
Enhancements and Fixes in 2.0.1