By Guilherme C. Hazan. Thanks to Ed Crandell for the first revision.
public void onStart() // called only once, at the first time the container is swapped
{
onAdd();
...
}
public void onAdd() // called everytime the container is swapped into, except the first time
{
setHighlighting();
}
You can hide most of the messages using this:
if (!waba.sys.Settings.onDevice)
waba.applet.JavaBridge.showMsgs = false;
Go to TOP- Sent by: guich@20021205
One way to do this is to create a file on the desktop, and then make a call to print the file from the command line (use Vm.exec, details in the SDK documentation).
HTML files can be printed like this:rundll32.exe mshtml.dll,PrintHTML "c:\temp\allclasses-frame.html"The nice thing about this command is that it will bring up the standard Microsoft Windows print dialog, which will allow users to select a different printer, etc. An option for printing text files is to use notepad as follows:
notepad /p foobar.txtThis prints directly to the default printer. Linux users can do a similar trick using kprinter or lpr to print the file. kprinter will bring up the printer dialog to print the specified file, lpr just prints the specified file to the default printer. Go to TOP- Sent by: VikOlliver - 01 Mar 2004
The /scale option, used in JDK, is not available in Windows 32. But you can use this workaround:
In order to provide gray scale support for earlier versions of the PalmOS, the screen memory and hardware registers must be accessed directly, instead of through the more normal and safer calls provided by later versions of the PalmOS API. You must disable the following options in POSE (right click, Settings/Debuggin):
Go to TOP- Sent by: crandell@20010627
Unfortunately, no. SuperWaba applications can't have access to native controls. That's why SuperWaba provides a different keyboard. There's an advantage to this: we can offer new controls, more customizable than the native controls. For example, Palm OS controls don't have a disabled state. Anyway, you can always create your own keyboard, trying to mimic the native one.
Go to TOP- Sent by: guich@20030117You have three choices:
superwaba.ext.xplat.io.SerialSocket and SerialSocketServer classes. These classes are for Serial connection only. For USB, Linux will handle it correctly, but in Windows you'll need a usb-to-serial cable.
/usr/sbin/pppd /dev/pilot 19200 192.168.11.2:192.168.11.1 proxyarp passive silent persist local noauth
Waba and SuperWaba will not allow you to open a socket before the main event handling loop has started. The problem is discussed in more detail in theWaba FAQ. The solution is to open the socket outside of your application's MainWindow? constructor and after the onStart method. A good place is in the onWindowPaintFinished method.
Put the socket.readBytes statement in a loop until either the count is greater than 0 or a predetermined amount of time has past. solution posted in newsgroup by
Go to TOP- Sent by: PeterCarroll?@20010627
Beaming apps does exactly that: It beams only the app's prc files, not its pdb files. Usually, a SuperWaba app consists of 4 files: SuperWaba.prc/.pdb, and YourApp?.prc/.pdb. You are only beaming Waba.prc/YourApp.prc. To beam all, you will need a utility such as the excellent BeamBox? or Filez programs.
Get it at http://www.palmgear.com
SuperWaba runs perfectly in Palm OS 3.0 and above. Palm OS 2.0 support was dropped on version 4.1 due to library's size.
Go to TOP- Sent by: guich@20010203
A good place to start on conduits is here:http://www.palmos.com/dev/tech/conduits/
Go to TOP- Sent by: guich@20010203
First of all, some words about USB and the features of your Palm. USB defines basically two types of devices that can be connected to the bus, host (master, usually a PC) and peripheral (slave, for example a printer). In each USB bus, one and only one host device at any time must exists, while there may be any number (max. 127) of peripheral devices connected at the same time to the same bus. Starting from revision 2.0 of USB standard, a new device type has been defined, named On The Go (OTG), which has the ability to become a bus master when it's connected to a bus with only peripherals, or a slave when another master is up and running.
The Palm is a USB peripheral, that means it needs to be connected to a bus where a host device is present, like a PC or a OTG device.
To communicate with such devices, it's possible to use the waba.io.SerialPort class, but in your java code, you have to open a specific port when you instantiate this class, that's the port number 0x8004. Using this constant in your code, you can open the USB port of your Palm for a generic connection, and all you need now is to implement a simple "driver" for the devices you want to communicate with, layered above the waba.io.SerialPort class.
This workaround has been tested on: Palm M515, Palm Zire21.
Settings.isHighColor (16bpp). Even if you're running in a 16bpp device without the /16 switch, it will return false.
Conclusion: If your program uses lots of images, use the /16 parameter option in Exegen, and THOROUGHLY TEST YOUR PROGRAM IN THE TARGET DEVICE, opening all windows and menus available.
Go to TOP- Sent by: guich@20040401
Since pdb records are limited to 64k, thats it: 64k. Also, everything in SuperWaba is limited to 64kb (well, not exactly 64kb, but 65500 bytes).
Go to TOPSometimes when you try to load an image, you get "OutOfMemory In imageLoadBmpCompressed". This happens because images require a very big piece of memory. For example, suppose a 120x120 bitmap:
1bpp (black/white): 120*120/8 = 1800 bytes 4bpp (16 colors) : 120*120/2 = 7200 bytes 8bpp (256 colors) : 120*120 = 14400 bytes. So, a 320x320x8bpp takes almost 102kb! The PDAs have a limited memory for everything, including images. So, loading lots of images can lead to problems. To bypass this problem, load only the images you're going to use, and try to decrease the color depth whenever possible (try to use IrfanView - a great free image converter). Be also always sure to use the web-safe-palette, or even the same colors in all 16 color images, or you'll have color problems. Go to TOP- Sent by: guich@20031208Please see examples/DrawingControl for an example.
Go to TOP- Sent by: guich@20010203
Currently, you can add 1/2/4/8 bits per pixel images to your app. It must be a bitmap in the .bmp file format, compressed or not. Jpg, Gif and PNG are allowed if you purchase the Professional Subscription at the site. 24bpp bitmaps are not allowed.
Go to TOP- Sent by: guich@20010203
Please see superwaba\samples\ui\painter example.
Go to TOP- Sent by: guich@20060417
Let's say you have a 256 color bitmap.
1. If you want to change one color by another color, use DRAW_SWAP_COLORS. EG: you can swap all red pixels with a purple color.
2. If you want to change all colors to another color BUT preserving one, use DRAW_REPLACE_COLOR. EG: you can preserve the red pixels while replacing all the other 255 colors with purple.
Are you using something like this?
//Pink borders on everything static final Palette PAL = new Palette(); static final Color WIN_COLOR = PAL.getColor(0x1E);To avoid it, remove the
static keyword:
// No pink borders final Palette PAL = new Palette(); final Color WIN_COLOR = PAL.getColor(0x1E);Another possible problem is that a number of images are being used with different palettes. Some PDAs can only support a small range of colours, and when they get re-used things can turn ugly. The trick is to use the same palette for all images where possible. Here's what to do to fix it: Load your image into The Gimp (either the Windows or Linux version) and find out how big it is (
Right-click, Image, Scale Image ).
Take an image from the SuperWabaSDK like ./samples/game/Ping/hockey.bmp and
load it into The Gimp.
Resize the image ( Right-click, Image, Scale Image again) to the size you
want. You will need to click on the little chain linking the X & Y ratio to
scale it unevenly.
Take your image, copy it ( Ctrl-A, Ctrl-C ) over the sample image ( Ctrl-V,
Ctrl-H) and save the resulting image as a new .BMP file. Use the new file
happily in SuperWaba.
Go to TOP- Sent by: MarkGonsalves?@20021205
SuperWaba already uses all the available memory of the PDA (in Palm OS, even more than the available). It also has a limit of 65500 bytes for any kind of object allocated. This means that a String must have a max of 32750 chars (each char is 2 bytes length), and that no single class file can have more than 65500 bytes.
If you have to read a file from somewhere, consider using the BigByteArrayStream class (available in the Professional SDK), which can read a file of any size.
Go to TOP- Sent by: guich@20080114Computers in general cannot represent all numbers in an exact way, due to limited space available for the precision. So, 1.1 maybe isnt stored as 1.1, but as 1.099999999. That's why sometimes you don't get the exact result as you expected. This is more critical with float (32-bit) datatypes: try to store something like 54321.12345, read the result back: you'll find that the value has changed. Double values use 64 bits, but this does not mean that all problems are gone. The general rule is: do not expect that floating point values are exact. For example, 2.0 % 0.1 == 0 will led to false in most places (even in your Pentium IV machine). Instead, check if 2.0 % 0.1 < 0.00001, then you'll get the correct result. For more information, see this and this.
Go to TOP- Sent by: guich@20031120When you run the Welcome app (clicking on SW VM icon), there's a VM menu option. By enabling the "Audible GC" option, you will start to hear some beeps every time the Garbage Collector (GC) is called. There are four kinds of beeps (here are the frequencies, lower frequency = deeper sound),
When you run the Welcome app (clicking on SW VM icon), there's a VM menu option. If you enable the "Dump Memory Stats", the VM will dump some memory statistics each time a program exits. By lowering the numbers, you can make your app run faster (PRO subscribers have the Optimization Tricks Tutorial included in the SuperWaba Companion.pdf tutorial). For more information, see SuperWaba.c
There's also a hidden way to dump the stats during the program's run: enter @?@ anywhere (the keystrokes are handled by the VM). Here's the dump and the meanings. Terminology: a chunk is a block of memory (16Kb) that stores objects. We maintain a list of SupportedDevices.
If you were able to run SuperWaba on a device not yet listed, please update the page to share the information with the SuperWaba community, thanks.
Starting in SuperWaba 4.21, yes. See Settings.romSerialNumber.
Go to TOP- Sent by: dodah12@20031111| Graphics+Native methods | Loop | Field | Method | Array | String + GC | Total | |
| Waba 1.0b | 143010 | 33340 | 8860 | 25940 | 126460 | 53250 | 390860 |
| SuperWaba 3.21 | 62920 | 21240 | 4030 | 11260 | 44500 | 18950 | 162900 |
Yes. SuperWaba uses a different creator id from Waba, so they can live together. Note also that this difference makes impossible to run a Waba application with SuperWaba, unless you recompile and repackage the application.
Go to TOP- Sent by: guich@20010203
SuperWaba doesn't support a few opcodes of java, like the synchronized keyword and also breakpoints. So, make sure you are not using them.
Go to TOP- Sent by: guich@20010203Message sent by Kambiz Darabi to the newsgroup:
I have almost finished porting a former SF app to Superwaba and I have experience in SF programming since 1998.
The speed is not a real issue apart from one single point: when you do case insensitive text searches in databases. There, you have a great performance difference between SF (native code) and SW (Java code).
This is the bad news.
But now the good news: there is already a native Catalog Search Library, which gives searches a performance boost.
And in general: if you have a task which has a bad performance in SW, you can always create a native library which would do the job much quicker. You would have to take the critical methods and port them to C.
Now for another comparison: If you have a moderately complex application and use the Visual Basic type of approach of SF, you have to be very very careful about your software development process. Your business logic is scattered in dozens of "onButtonClicked" and "onValidate" etc. functions in your different "Forms" and there is a good chance of getting into trouble because of side effects of changing global vars etc.
In SW, you can take full advantage of the object oriented approach: you can put your business logic into some distinct classes; you can use a model-view-controller pattern to always keep GUI, data, and business logic separate; you can create re-usable graphical and non-graphical objects which can be quickly reprogrammed; you can use javadoc to document the functionality of your classes; you can use a code repository for team development (e. g. CVS) ... I could go on with this forever, as I'm very enthusiastic about Java after having programmed in different machine languages, Basic, Pascal, Prolog, Lisp, Tcl, C, C++ ...
I would personally never, never go back to Satellite Forms.
Sure! SuperWaba is 99% compatible with Waba. These are the 1% incompatibilities:
There is a specific tutorial for this: The SuperWaba Library Tutorial, that is included in the SuperWaba Companion.pdf file available in the PROFESSIONAL subscription SDK. If you are unable to afford the meagre price of the tutorial, then look at the scanner library as an example.
Go to TOP- Sent by: guich@20010203
Please check the SuperWaba site, menu PLATFORM / FEATURES.
Go to TOP- Sent by: guich@20031110You can post messages from here. But please note that sometimes there's a delay to display the message or it is simply lost. Note also that it contains less than 50% of the messages.
IMPORTANT: do not use this, because GOOGLE points to the old falch.net server, not to the current superwaba.net one. So, posting there will not be viewed by the majority of the community.
Go to TOP- Sent by: guich@20030411No pain! Just buy a support package at the SW site. A support incident has maximum priority for us, so we'll stop everything we're doing to find a solution for your problems. After the bug is fixed, a new VM will then be sent to you.
Of course, you can always look at the Codev section of the SuperWabaWiki site and at least try to fix it... Go to TOP- Sent by: guich@20030221Since Waba 1.0b was released, in 14 Feb 2000, it has not been enhanced by Rick Wild, its creator. There was a people that enhanced the 1.0b version a bit, at http://waba.sourceforge.net, but they also have not enhanced it since may 2001. SuperWaba, in contrast, from version 1.0G to 3.3, had about 31 releases! More than one per month (1.0G was released in July 2002). Below is a table with some major differences between SuperWaba and Waba.
| Description | Waba | SuperWaba |
| Number of classes (not counting java.lang, waba.applet and ext packages) | 36 | 69 |
| Size (classes + VM) | 72.3Kb | 293Kb |
| Speed comparision (running Bench program - lower timming = faster) | 390860ms | 162900ms |
| Memory avail for programs in PalmOS | 32kb | Unlimitted (up to the device´s avail space) |
| Supports Exception | No | Yes |
| Supports Color | No (in sourceforge, yes) | Grayscale and color in all palm devices |
| double/long (64 bit precision) support | No | Yes |
| User Interface | Extremely simple | Very complete |
Here are the statistics from January 2002 to September 2004:
Total number of members:
| 2002 | 14355 |
| 2003 | 22394 |
| 2004 | 11649 |
Subscribed Members per month:
2002| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
| 35 | 1089 | 991 | 1325 | 828 | 575 | 1219 | 1879 | 1762 | 1839 | 1693 | 1339 |
| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
| 1700 | 1688 | 1332 | 1120 | 1340 | 1421 | 2309 | 2060 | 2196 | 2383 | 2252 | 2593 |
| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec |
| 2505 | 1560 | 1065 | 978 | 1157 | 1094 | 1127 | 1044 | 1119 | |||
| 2002 | 2003 | 2004 |
| 14 | 6 | 4 |
Top five countries:
2002| USA | 3066 |
| Germany | 1203 |
| Brazil | 1203 |
| France | 768 |
| UK | 506 |
| USA | 8400 |
| Brazil | 4353 |
| Germany | 2465 |
| France | 2108 |
| UK | 1574 |
Number of users that downloaded each version:
| version | downloads |
| 1.21 | 474 |
| 2.0b4r3 | 357 |
| 2.0b4r4 | 152 |
| 2.0b4r5 | 161 |
| 2.0b4r6 | 311 |
| 2.0b4r7 | 227 |
| 2.0b4r8 | 972 |
| 2.0b4r9 | 619 |
| 2.0final | 887 |
| 2.1 | 663 |
| 2.2 | 1439 |
| 2.41 | 4105 |
| 3.0 | 2144 |
| 3.11 | 1050 |
| 3.2 | 950 |
| 3.21 | 4151 |
| 3.3 | 4433 |
| 3.4 | 1261 |
| 3.41 | 2333 |
| 3.5a | 6354 |
| 4.0a | 2695 |
| 4.01 | 7346 |
| 4.1 | 4546 |
| 4.2 | 2993 |
| 4.21a | 1389 |
| 4.21b | 5585 |
Site statistics for visits
| 2003 | 2004 | 2005 |
| 255227 | 233070 | 361265 |
Starting on version 5.0, we added this possibility. The ListBox? itself does NOT have the horizontal scroll mechanism, but you can easily add it with two new methods. Next, the sample, taken from sdk/src/java/superwaba.ext.xplat.unit.SWUnit.java:
Add the ListBox?, then add a horizontal scrollbar near it:
add(sbHoriz = new ScrollBar(ScrollBar.HORIZONTAL));
sbHoriz.setRect(LEFT,AFTER,FILL-2,PREFERRED);
sbHoriz.setLiveScrolling(true);
After you add the items, set the horizontal scrollbar values, based on the text inside the ListBox? (note that this may not be done at each new ListBox? item because it will make it much more slooooooooow):
// update the horizontal scroller
int needed = lb.getNeededHorizontalScrollValue(); // get maximum text size for the listbox
if (needed <= 0)
{
sbHoriz.setEnabled(false);
sbHoriz.setValue(sbHoriz.getMaximum());
}
else
{
sbHoriz.setEnabled(true);
sbHoriz.setMaximum(needed);
sbHoriz.setMaximum(sbHoriz.getVisibleItems()+needed); // set again, bc we must include the visible items
sbHoriz.setValue(0);
}
Now, you must scroll the list when an event is catched:
public void onEvent(Event e)
{
if (e.type == ControlEvent.PRESSED)
{
...
if (e.target == sbHoriz)
{
lb.setOffset(-sbHoriz.getValue()); // scroll the text
lb.repaintNow();
}
That's it! Now you have a horizontal scrolling listbox.
Go to TOP- Sent by: guich@20041225
Use the SuperWaba User Interface Guidelines, placing controls in a relative-to-the-last manner. There is a great tutorial for this, the SuperWaba User Interface Tutorial, that is included in the SuperWaba Companion.pdf
Go to TOP- Sent by: guich@20010203
The constructor is executed first, and onStart immediately after. In the device, there is really no difference at all; But in the desktop, the Graphics object is available only in the onStart method; so, if you use a bitmap splash screen, you must put your initialization code in the onStart method, otherwise, it will not be shown.
Go to TOPBe sure that the containers which are siblings, ie, have the same parent, are not OVERLAPPED. Be also sure that the container's bounds are correctly set.
Go to TOPAre you calling Window.pumpEvents() anywhere from within a SW Thread? You have to be careful when calling pumpEvents from within a SW Thread. Threads are also executed within pumpEvents() (so that threads will continue running while a blocking modal is open), and if your thread calls pumpEvents() without doing any kind of checking, pumpEvents() will then call your thread, which will call pumpEvents(), which will call your thread, etc, until stack overflow.
Another check you should always do is to surround pumpEvents() in a check for Event.isAvailable(), as pumpEvents() may block (on some systems) until an event is available. In other words, unless you are willing for pumpEvents() to block (not return) until an event is available, do this:
if (Event.isAvailable())
Window.pumpEvents();
Vm.sleep(10);
The Vm.sleep() allows background events such as dialogue processing to occurr.
Also, timer events are handled very similar to threads in SW so that if you have an unchecked Window.pumpEvents() inside of a timer event, you could have the same problem with infinite recursion. This is not to say you can't put Window.pumpEvents() in a timer or thread, you just have to be careful that you do not call Window.pumpEvents() every time the timer or thread executes.
Go to TOPAdded by anodos@20021005 annotated by VikOlliver@20051117Are your screens extending waba.ui.Container? Don't extend Window classes to add them to the MainWindow? - typically this will cause eveything in the new window to shift downwards a few lines. Window classes must be used only as Popup Windows.
Also, use the MainWindow?.swap command (see examples/ContainerSwitch)
Go to TOP- Sent by: PeterCarrol?@20010205
Use setDoubleBuffer(true) method in your application's MainWindow? class constructor
SuperWaba controls do not update its size when a setText or equivalent method is called. To resize the control, use this after the setText or setImage:
myBtn.setText("a text bigger than before!");
Coord c = myBtn.getPos();
myBtn.setRect(c.x,c.y,PREFERRED,PREFERRED);
Go to TOP- Sent by: guich@20021205
public class MyProgram extends MainWindow
{
TabPanel tp;
public void onStart()
{
String tabs[] = new String[]{"One","Two"};
tp = new TabPanel(tabs);
tp.setRect(10, 10, 80, 120);
tp.setGaps(2,2,2,2);
tp.getPanel(0).add(0,new Edit(),0,0);
tp.getPanel(1).add(0,new Label("Hi!"),0,0);
add(tabBar);
}
public void onEvent(Event event)
{
if (event.type == ControlEvent.PRESSED && event.target == tp)
{
int activeIndex = tp.getActiveTab();
... handle tab being pressed
}
}
}
Go to TOP- Sent by: guich@20010203
Please see the waba.ui.InputDialog, waba.ui.MessageBox and waba.ui.Window classes. There is also a version called MessageBoxChunky in the free program downloads on the SuperWaba web site. BTW, the popup windows looks like this:
MainWindow .Window class.popupModal(myWin) to popup that window.unpop() method.popupModal method is not blocking; the program continues immediately after the window is shown. To block the program execution until the window is closed, use popupBlockingModal instead.
Use the following code (example taken from the Window class)
class TestWindow extends Window
{
Button btnHi;
public TestWindow()
{
super("Test",TAB_ONLY_BORDER); // with caption and borders
setRect(CENTER,CENTER,Settings.screenWidth/2,Settings.screenHeight/4);
add(btnHi=new Button("Hi!"));
btnHi.setRect(CENTER,CENTER,PREFERRED,PREFERRED);
}
public void onEvent(Event event)
{
if (event.type == ControlEvent.PRESSED && event.target == btnHi)
unpop(); // a WINDOW_CLOSED event will be posted to this
// PARENT window by the Window class.
}
}
To use it:
class MyApp extends MainWindow
{
TestWindow tw;
public void onStart()
{
popupModal(tw = new TestWindow());
}
public void onEvent(Event event)
{
if (event.target == tw && event.type == ControlEvent.WINDOW_CLOSED)
{
tw = null; // or any other stuff
}
}
}
For more information, see the javadocs for waba.ui.Window.Go to TOP- Sent by: guich@20010203
There are two ways to access the menu in Windows CE:
Use this:
Button.commonGap = 2; // construct and add your Combo/Listbox to the container Button.commonGap = 0; // reset it.Starting in SuperWaba 4.21, there's also a ComboBox? and ScrollBar? field named extraArrowSize, which will increase the arrow bitmap. Go to TOP- Sent by: guich@20040122
SuperWaba uses a simple clipping algorithm (see Container.paintChildren). Because of this, it can't handle complex clippings that the ScrollContainer? would make necessary. This would make the control's paintings to overflow the ScrollContainer?'s area. There are some controls available out there (e.g.: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/jdict/jdict/jdict_P/src/jdictp/guidevice/ScrollBox.java) but they may fail in some cases.
Another scrolling container you might like to look at is ControlListBox A better scrollable container is in development at the moment. See the HTML classes. Go to TOP- Sent by: guich@20030210This happens because you had not prepared your code for superior resolutions. In SuperWaba, the controls are placed in a relative position. But that requires that you specify the Windows size. Since in a bigger resolution the size must change, you need to test it and find the best size for your window in this bigger resolution. To make the old programs work, SuperWaba tests if the flag highResPrepared is set. If not, SuperWaba sets the size of the Window to be twice the specified size, and repositions the Window in the center of the screen. So, you must do something like the code below:
public MyWindow()
{
super("My Win",RECT_BORDER);
highResPrepared = true;
// test if we're running in Sony devices, with big fonts
boolean higherResolution = fmH > 11;
float factor = (float)fmH / 11f;
int w = (int)(100 * factor);
int h = (int)(120 * factor);
setRect(CENTER,CENTER,w,h);
...
Important note: if you want to emulate a Sony 320x320 device, use the following parameters:
rundemo /w 320 /h 320 /scale 1 /useSonyFonts /bpp 8To emulate a Windows CE or Pocket PC device with 240, 480 or 640 horizontal resolution, use:
rundemo /w 240_or_480_or_640 /h 320_or_anything /scale 1 /bpp 8If you are using more recent versions of SuperWaba that use a build.xml file, copy one of the sample build.xml files such as the one in SWCalc and edit it to replace SWCalc with your application's name. Then you can edit the "run-init" section to look like this, and change the values to suit your situation:
<target name="run-init" depends="build-init"> <property name="applet.scale" value="1"/> <property name="applet.bpp" value="8"/> <property name="applet.width" value="320"/> <property name="applet.height" value="320"/> <property name="applet.uiStyle" value="WinCE"/> <property name="applet.useSonyFonts" value=""/> </target>Go to TOP- Sent by: guich@20021005
The window that you are trying to pop the MessageBox? up on top of is not ready yet.
To get round this, use a Container to hold the code that wishes to do a popupBlockingModal, and do Window.getTopMost().popupBlockingWindow() from within it. This will work in the onStart() method of the Container because you create the main Window before the Container is initialised. This is an example of the use of Swap to load a container from a main Window class:
public void onStart() {
/* Now we get our client rect, excluding the border and the title */
Rect r = getClientRect();
/* Prepare the splash screen. */
splash=new SplashScreen(); // A Container
splash.setRect(r);
/* Swap in the SplashScreen module. */
swap(splash);
}
Go to TOP- Sent by: vik@20042901
To get round this, use a piece of code in the onExit of your MainWindow?. something thus:
public void onExit() {
setStatePosition(0,Window.VK_BOTTOM);
}
Go to TOP- Sent by: sivuca@20042110
All you have to do is use the new superwaba.jar file with the old PDBDriver classes at desktop. The device files remains unchanged.
Here's the script: Grab the superwaba.jar you have in your old SuperWaba version. Rename it to pdbdriver.jar. Now open it (winzip opens it) and delete all classes, except the superwaba.ext.xplat.sql.pdb ones. Now add this pdbdriver.jar to the classpath, and use the 5.7 (and up) virtual machine along with the XPlatSqlPdb?.* files from your old SuperWaba version.
QuestionDon't modify the creator id. You have to use the same that warp generates for your programs. This is because the creator id is used to attach the databases to your program. This way, when you delete your prc from the palm, the database associated with it will also be deleted. Since you discovered who is your creator id (by using waba.sys.Settings.appCreatorId ), put it statically in your code. To have different databases in your application, you can create different types. So, lets say your creator id was put an a variable
String creator = "xxxx"; String type = "MyDa"; // stands for My Data
When you create the new catalog, use:
cat = new Catalog(type+"."+creator+"."+type,Catalog.CREATE);
Only by using this approach, you will be able to use your database in a java conduit.
Note that Catalog.CREATE does not overwrite the pdb if it exists.
Go to TOP- Sent by: guich@20010203
Yes, see superwaba/examples/TestCatalog.java.
Don't forget to read the Catalog chapter that is included in the SuperWaba Companion.pdf.
Go to TOP- Sent by: guich@20010217
// open the catalog
String creator = waba.sys.Settings.appCreatorId;
String type = "MyDa"; // stands for My Data
Catalog cat = new Catalog(type+"."+creator+"."+type,Catalog.CREATE);
DataStream ds = new DataStream(cat);
// read from it
if (cat.setRecordPos(0)) // read record 0 - if it exists
{
int anInt = ds.readInt();
String aString = ds.readString();
}
cat.close();
Use the following piece of code to write over the previous stored record
// open the catalog
String creator = waba.sys.Settings.appCreatorId;
String type = "MyDa"; // stands for My Data
Catalog cat = new Catalog(type+"."+creator+"."+type,Catalog.CREATE);
ResizeStream rs = new ResizeStream(cat,256);
DataStream ds = new DataStream(rs);
// part 2
int anInt = 334455;
String aString = "HI world!";
if (cat.setRecordPos(0)) // delete it first
cat.deleteRecord();
if (rs.startRecord(0)) // reinsert it in this index
{
ds.writeInt(anInt);
ds.writeString(aString);
rs.endRecord();
}
cat.close();
Note that when just reading from a catalog, there's no need to attach it to a ResizeStream?.
Go to TOP - Sent by: guich@20010203
You can read the text from your desktop computer using java.io.* classes and use the class Catalog from SuperWaba to create the pdb file. Then, just synchronize it to your Palm. Please see utils/xplat/ImportTxt for an example.
Go to TOP- Sent by: guich@20010203
Catalog.deleteRecord , my waba app freezes... Whenever you call deleteRecord() , make sure that the current record position has been set. EG:
cat.setRecordPos(0); cat.deleteRecord();Go to TOP- Sent by: edCrandell@20001013
onExit() method. I am doing this in a straightforward way but periodically I get a "Bus Error" from the Palm Emulator stating Waba 1.02 is giving it. On Palm Pilot itself, the error is "Fatal Exception".
Adding a Vm.sleep(10) resolves the problem. See the following code:
public void onExit()
{
Vm.sleep(10);
strEditText = edit.getText();
writeRecord(prepareRecord(),recIdx);
}
Go to TOP- Sent by: KevinG?.Paterson@20001031
Look at this code sample:
public static void main(String args[])
{
waba.applet.JavaBridge.setNonGUIApp();
waba.io.Catalog cat = new waba.io.Catalog("\\superwaba\\classes\\Pupil.Font.Font",
waba.io.Catalog.READ_ONLY);
if (cat.isOpen())
debug("ok, is open");
else
debug("not opened!");
}
Note that when using nonGUIApp, you cannot use the waba.ui and waba.fx package, or your program will fail. Also note that in this special mode you can specify the full path to the file, appending the crtr.type but not appending the .pdb. The program will take care of it.
Go to TOPHere it is:
// here is an example of use:
// if (findByBinarySearch(barcode) == -1)
// {
// /*ERROR*/
// }
// else
// {
// /*GET RECORD*/
// }
private int findByBinarySearch(String barcode)
{
int numRecords = cat.getRecordCount();
int lowpos = 0;
int highpos = numRecords - 1;
int currentpos = 0;
String key;
while(true)
{
currentpos = (lowpos + highpos) / 2;
cat.setRecordPos(currentpos);
key = ds.readString();
if (key.equals(barcode))
return currentpos;
if (highpos == lowpos + 1)
lowpos = highpos;
else
if (lowpos == highpos) // not found
return -1;
else
if (barcode.compareTo(key) > 0)
highpos = currentpos;
else
lowpos = currentpos;
}
}
Go to TOP- Sent by: Tony Goodwin
Because of a bug in SuperWaba 2.x desktop versions, all the records in the created PDB was marked busy. In the Windows CE implementation of the Catalog the record is tested if is busy. Since it is busy, the Catalog.setRecordPos method i just return and you have no access to the record.
You have two choices: 1. Generate again at desktop all databases, with SuperWaba version 3 (or newer). or 2. Do a program that opens your database but don't close it. Then, you do a reset in your device. This will make the dmHdrAttrOpen to remain true. The next time you open the catalog, my routines will reset all busy attributes. Go to TOP- Sent by: guich@20021005versapalm.finance.VPFinance application is warped and exegen'd:
\jdk1.2.2\bin\java -classpath \jdk1.2.2\lib\rt.jar;\superwaba\bin;\superwaba\classes;.
Warp c VPFinance versapalm/finance/VPFinance.class
\jdk1.2.2\bin\java -classpath \jdk1.2.2\lib\rt.jar;\superwaba\bin;\superwaba\classes;.
Exegen "Finance" versapalm/finance/VPFinance VPFinance
Note that the . in the classpath means that I'm in the parent directory of versapalm/finance/... If you get the following error during a build of Superwaba:
BUILD FAILED file:
"PalmChars.h"
case vchrNavChange: // 5-way ... break;Go to TOP- Sent by: Steve Kelem@20030410
SuperWaba has great extensions, located under superwaba/ext/... . They are not part of the VM because most users don't need them. If you do need them, then you need to:
c:\superwaba\... , then you must add c:\ to the classpath.
/superwaba/bin/<platform>/libraries) which contains the compiled classes that can be used at the device. To find which pdb you need to install, please check the javadocs of the package you want to use. E.g.: to use superwaba.ext.xplat.ui.MultiEdit , check the javadocs for superwaba.ext.xplat.ui .
You're probably using JDK 1.4.x. This version changed the way that methods are called internally, thus resulting in some weird inheritance problems. I preferred not adapt the VM to handle this because it would make method calls much slower. Fortunately, the workaround is very simple: use "-target 1.1" in your javac command line and your problems are gone.
Go to TOP- Sent by: guich@20030216In SuperWaba, you can't use java.lang.Integer , java.lang.Double , etc. But everything you need is provided int the waba.sys.Convert class.
JDK 1.1.x, 1.2.2, 1.3.x, 1.4.x and 1.5.x. The best version, which produces the optimal class files, is version 1.2.2. Note also that SW have some problems with JDK 1.4.1. You must specify "-target 1.1" in the command line of javac.
Go to TOP- Sent by: guich@20010203Starting on version 3.5, you'll need to use ANT. Please see the SuperWaba.pdf file inside the SDK for more details.
Go to TOP- Sent by: guich@20030619
Note: besides of what is described below, which may be useful for others, you can use 1.5 with superwaba by using: javac -target 1.1 -source 1.3 ...
SuperWaba needs Java 1.1 compatible bytecode. You can tell your javac compiler to generate code different from the javac version of the compiler, using the -target command line option. Unfortunately JDK 1.5.0, facing increasing backwards compatibility problems, does not support target version 1.1 anymore. So you need multiple JDKs installed on your machine. Unfortunately you cannot install an older version of W32 JDK after you have installed JDK 1.5.0. It will crash your 1.5.0 runtime environment and JDK 1.5.0 cannot be uninstalled anymore. If this happened to you, you have to install the full JDK 1.5.0 including the runtime environment over your messed up system, which fixes it. Then you can uninstall JDK 1.5.0 properly. And only now you are ready to uninstall and reinstall the older JDK 1.2.2 (or 1.3.1). You only need the SDK, to get the 1.2 (or 1.3) compiler. You don't need the old runtime, if you will use Java 1.5.0 as your default. It is ok now to install JDK 1.5.0 (including the runtime environment), after you have JDK 1.2.2 (or 1.3.1) installed properly.
Now you will find, that it is difficult to run the JDK 1.2 (or 1.3) compiler on command lines or on your favorite IDE like Eclipse. And the many hints and options offered to support multiple runtime environements not only don't seem to work at all, but also have nothing to do with your problem to use an old compiler, which is part of the JDK, not the JRE. To compile SuperWaba classes using a specific compiler, you can use the Javac ant task parameters fork, executable and compiler as on the following example, tested with ant 1.6.2:
<javac srcdir="C:\DATA\Development\eclipse\workspace\PocketELZE\src"
destdir="build"
target="1.1"
fork="yes"
executable="C:\java\jdk131\bin\javac.exe"
compiler="javac1.1">
<include name="**/*.java"/>
<classpath refid="classpath"/>
</javac>
Now you can change your build.xml file to use these settings. You may want to use a copy of the build.xml, that comes with SuperWaba for the SWCalc sample application as a perfect starting point.
Go to TOP- Sent by: RenatoMercurio?
exegen gives the error: Launch string too long? At first you have to know that the problem is in the exegen program not in your class name. The exegen has a String lenght limit of 200 characters in its arguments. You have to create a new alias class that has a simple name like:
package mgenix;
import waba.ui.*;
// the correct example should be a package with more than 190 characters
import com.mediageniz.vision.visioningApplication;
public class VisionApp extends visioningApplication
{
public void onStart()
{
super();
}
}
Go to TOP- Sent by: MarkoChu?@20001128
No need. Starting in SuperWaba 3.21, WExtras was completely merged into the superwaba.ext package. Also, all duplicated classes were removed.
Go to TOP- Sent by: guich@20010203
Yes. Just use the /v Go to TOP- Sent by: guich@20010203
Don't use *.class. Please specify instead the name of your class that extends waba.ui.MainWindow, and all classes it uses will be automatically added. For example: Go to TOP- Sent by: frank@20040502
It turns out that Application Manager cannot work with files which have a program name longer than 8 characters. That is, the word before the ".Platform_CPU.CAB" must be 8 characters or shorter. For example: changing "CoursePro.PocketPC_ARM.CAB" to "cp.PocketPC_ARM.CAB" (along with the other 9 CAB files) will prevent Application Manager from crashing.
Go to TOP- Sent by: DanielMeehl@20040514
This is now fixed in SuperWaba 4.21a. The cab files are now named so there are no issues. Developers should upgrade their SDK for these changes.
Go to TOP- Sent by: IanGeiser@20040603
You should modify the file build_superwaba.xml of the project and add a line with arg value "/lg" to the parameters of Warp, as shown below:
Then you go to the project Properties, Builders tab, and Import the build_superwaba.xml you have just modified. Now tell eclipse to Build Project, but not to Build SuperWaba Application, otherwise the build_superwaba.xml will be deleted and created for new.
A longer explanation is given in this tutorial http://robotica.uv.es/~jjordan/tutorials/eclipse/library.html
You can retrieve the appSettings value via a conduit by calling the Thanks Michal Hobot, SW now has a good installer. You can, using the /z option in Exegen, create install files for your applications (Windows CE only).
For distribution of your SuperWaba application on PalmOS and WinCE?, SourceXtreme?, Inc has released their GPL installer for PDA devices. This can be downloaded at:
http://www.sourcextreme.com/projects/matchbox
With this installer tool developers can distribute their SuperWaba applications in a single Windows executable binary that will install their application on their Palm or
Question
I'm compiling the program from command line with<command-line>Warp c Test *.class; but I get Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1. What's wrong?
Warp c Test Test.class
Go to TOP
Question
When i run Ant, why does java complain about JIT errors ?
The JIT support of some old JDK versions have bugs and or not compatible with some java applications such as Ant.
The solution is to disable the JIT like explained in the JDK 1.2.2 documentation
set JAVA_COMPILER=NONE
anT try again...
When I try to install my PocketPC/WinCE application, why do I get "Application Manager cannot install this application on your mobile device due to an invalid setup file." error message?
Question
I would like to build a Global Extension Library within Eclipse, but the Eclipse SuperWaba plugin does not offer this option. How can I do it?
<!-- Execute WARP -->
<target name="warp" depends="jar">
<java dir="build" classname="Warp" fork="true" classpathref="utils">
<arg value="c"/>
<arg value="/lg"/>
<arg value="${ant.project.name}"/>
<arg value="${ant.project.name}.jar"/>
</java>
</target>
Go to TOP- Sent by: juangui@20050204
Conduits and SuperWaba
Question
How can I retrieve the Settings.appSettings string in my Palm CDK-based conduit?
SyncManager.SyncReadAppPreference
function (for JSync conduits, the function is SyncManager.readAppPreferences
). There are a couple of things to note:
Go to TOP- Sent by: JeffFaath?@20040806
Program deployment
Question
I want to deploy my application to end-users. Any hints?