Journey into SuperWaba

Ever wonder what it takes to write programs for your PDA? I did, and so now I am beginning a journey to try my hand at writing something for the PalmOS. SuperWaba, a variation of Java for the PDA, is my language of choice. And I'm a novice, which makes it all the more unpredictable. Hope you'll come along for the ride! Note: You can read multiple posts on one page if you click on an archive link.

Thursday, July 15, 2004

First SuperWaba Program (Shell)

Today, I am thrilled to be writing about actually programming something trivial and running it on my SJ33 Palm Clie. We'll also run in on a TE emulator. But not on a Sony emulator because of Sony's lack of ongoing support for the Clie line.
What we will run is really just a program shell that is created by MobileCreator when you start a project, so it's not like I'm really writing any lines of code yet. Still, I'm very happy to get one step closer!
First things first. I've installed MobileCreator with the Palm emulator (not really needed anymore because I'm going to simulate the TE instead), the Palm simulator set up for a TE, and the Sun SDK.
So far things are pretty straightforward, but let me describe a couple of the settings. I intended to put some screenshots here, but turns out that's only easy if I'm updating the blog with FTP, or if the pictures are already online somewhere. Neither is the case for me at this point, so intead of screenshots, here's a description of some of the key settings I've chosen...
(Under Project... Settings... )
At Exegen Tab...  I've checked "Start Exegen"
At Warp Tab...  I've checked "Start Warp" and "Recurse Subdirectories"
At JDK Tab... Use java.exe
At Paths....
    SuperWaba path = C:\Java\SuperWabaSDK    JDK path = C:\j2sdk1.4.2_04    Emulator = C:\Java\POSE\Emulator.exe
    Simulator = C:\Program Files\TESimulator\PalmSim.exe
    Applet = Well, this doesn't really matter because I can't get it to work right. Instead I'm using the simulator.
We're almost ready after the simulator is setup. As I indicated, the TE simulator is a best case alternative for either an AppletViewer or a Palm Emulator for SJ33. Neither of those seem to work, in the sense that I can't get the applet viewer to use my fonts and the SuperWaba newsgroup community considered my case unworthwhile or uninteresting. And the SJ33 roms are not available because Sony has cut off support to the Clie line. Did I mention yet how disappointed I am in Sony?
Okay. As far as setting up the simulator, you get it from the Palmsource developers web site just like the emulator. I guessed at a few parameters to set. After you launch the simulator, you have to do the startup preferences routing and then you can right click and set 32 meg RAM and increase the dynamic heap memory to 2048 KB. You may have to do preferences one more time. I then installed the SuperWaba palm files for OS5, and the LSW/MSW/HSW font files for SuperWaba.  At that point I did Storage... Save to save my profile.
Now it's supposed to keep all the session info in the palmsim.ini file that's in the same directory as PalmSim.exe. It will then launch next time in the same condition it did the first time. Well that wasn't happening for me and every time I launched the simulator application I had to redo preferences and load the .ssf settings file I had saved the previous time. I called mine storage_snapshot.ssf.
Well, even worse, MobileCreator is supposed to be able to launch the simulator as part of the compile and run process so that with one click of the mouse in MobileCreator you can compile and run on the simulator. Pretty nifty! If only I could get it to work. I won't go into all the details of the round about way that I came up with an answer (partly because I don't remember the details, and partly I'm embarrassed to tell you all the rabbit trails I went down to try to do a "workaround" before I found out how simple it is!)
The simple answer is that you just need to make sure that you have the following lines in your palmsim.ini file...  (but use your own settings filename, of course)
LastStorageSnapshot=C:\Program Files\TESimulator\storage_snapshot.ssf
StorageSnapshotFile=C:\Program Files\TESimulator\storage_snapshot.ssf
Now everything works like a charm. Open up MobileCreator and create a new project. The program looks like this (sorry again about the formatting -- I need to find a solution for that in this blog pretty soon!):
import waba.ui.*;
import waba.fx.*;
public class HelloWorld extends MainWindow {       
Font font = new Font("Tiny", Font.BOLD, 10);       
String menu[][] = {              
{"About HelloWorld","Info"}        };                    
public HelloWorld() {               
highResPrepared = true;               
setMenuBar(new MenuBar(menu));       
public void onStart() {       
public void onEvent(Event event) {               
highResPrepared = true;       
public void onPaint(Graphics g) {       
Some of the hires and font stuff may differ from what you get if you are giving it a try. I was doing a lot of playing around with the font related stuff to make it look right on my Sony. Don't know yet what is important and what is extraneous. And I also added some text that looks like HelloWorld just to make it feel more like a HelloWorld-like program.
Set the drop down box to Palm Simulator and click the green flag toolbar button for save, compile and run. There it is!!!! You also get the .prc and .pdb files to install on your Palm if you checked the Start exegen and Start Warp boxes in project settings. Install them just like any other programs on your Palm, and you can see the results work there also!
That's actually pretty neat! We haven't really coded anything, but as you can tell, we've made a lot of progress. Still some big unanswered questions...
*) How does all this hi-res stuff and font-selection stuff work?
And the main point of this whole exercise, which is
*) How do I code to this Java-like API to write a real program?
Okay, so what's next? We have a program shell, but it's really not a HelloWorld program. There is a WabaSoft document that tells all about writing a simple program. I hope to get a real working  HelloWorld program based on that document's information.
Later possibilities....
* Do the scribble program from that same document.
* Compile and run some example programs from
* Start writing examples of some basic GUI
* Try the GUIbuilder. (It's written in SuperWaba, and is supposed to allow you to do GUI design right on your Palm. At least that's my impression, so it's worth a look.)
* Maybe buy and work through the tutorials. I have to admit the cold reception from the SuperWaba newsgroup makes me perfectly content to delay that decision until I'm more comfortable that SuperWaba will work for me. And obviously, you feel more interested in helping out a community if they don't reject you! But despite the feeling of mistreatment, I really like what they're doing, and I'm pretty sure they aren't in it for the money but out of good will and genuine interest in PDAs. So I guess for now, SuperWaba is still on my "good things in this world" list. I may change my mind later, but always best to give the benefit of the doubt. Unfortunately, I suspect that without community support, I'm sunk for any serious endeavor, so after playing around with SuperWaba enough to feel like I've learned some basics, I may jump to NSBasic or another commercial product. Or if the road gets tough with SuperWaba, I may just throw it back in the pond and go fishing elsewhere. Lots to ponder, but it's still early, so there's plenty of time to ponder those sorts of things. As I said before, so far so good!
Just for your reference, here's the settings I have in my palmsim.ini file. Note that there are some secureit references in there also. That's a great tip for you also that I found by experiment. Have you got a security/encryption program like SecureIt that holds passwords and such, but doesn't have a desktop version? Well, suppose you drop your Palm into the river? How are you going to get to that essential information? You certainly don't want human readable backups laying around just in case, and they wouldn't be up-to-date anyway. Well, you could buy another Palm device. OR.... if you have a simulator set up, you can use the simulator. Install the program and the associated files with the data and voila! You can run the program on your simulator on a PC!
Okay, back to SuperWaba. Here's the contents of my .ini file for the simulator. See you next time!
ROM=C:\Program Files\TESimulator\EFIGSP\TungstenE_EFIGSP.rom
Standard RS-232InfraredPort=
LastStorageSnapshot=C:\Program Files\TESimulator\storage_snapshot.ssf
StorageSnapshotFile=C:\Program Files\TESimulator\storage_snapshot.ssf
MRU_PRC[0]=C:\Program Files\TESimulator\AutoRun\Secure_It_Templates.PDB
MRU_PRC[1]=C:\Program Files\TESimulator\AutoRun\Secure_It_Secrets.PDB
MRU_PRC[2]=C:\Program Files\TESimulator\AutoRun\Secure_It.PRC
MRU_PRC[3]=C:\Program Files\TESimulator\AutoRun\HelloWorld.pdb
MRU_PRC[4]=C:\Program Files\TESimulator\AutoRun\HelloWorld.prc


Post a Comment

<< Home