The first step in developing my program was to create a directory called GuessMe, for lack of a better name. Next, I opened the CASL IDE in Windows, selected "New Project" from the menu, entered my project name and began placing controls (or objects) on the CASL form. I was a bit thrown off by the documentation until I realized that a frame and form are the same thing (the documentation used them interchangeably). I wanted to keep my program simple, so there is only one form in my application. I added a label, a button and two text boxes. One text box to enter your number guess; the other to display the response if the guess was higher or lower than the value that the computer picked.
I didn't like how the responses looked in the text box. I wanted something that was colorful, included some nice hi-res graphics and a more appealing look. The text box could only contain, you guessed it, text and only one color and no bitmaps. I sent an email to CASL support and asked if they had any suggestions, their response was to use the grid control.
The grid control is, indeed, very useful - think of it like a miniature spreadsheet. Each column can contain a series of buttons, labels, checkboxes or text controls, any of which may be bound to a database field. In my simple program I'm not using a database, but it's nice to know the capability is there if you need it. Each of the controls in the grid can be a different color, contain a different image (or bitmap), it was exactly what my game needed.
Learning how to use the grid and to change its attributes requires careful attention to detail. Controls and arrays in CASL are 0-based, that is, the first row starts with an index of 0, not 1. If you try to assign an index value to a row which exceeds the number of rows available in your grid, you'll get an error in your program.
I found the language syntax fairly easy to learn and similar to BASIC (Beginners All-Purpose Symbolic Instruction Code) which I used many moons ago on my Commodore C=64s, and in office jobs where we used Radio Shack Tandy Model III computers, ($2500.00 a pop, believe it or not). So some experience with BASIC helped. The most important function my program needed to perform was to pick a random number. To accomplish this, use the function "randomn" (the documentation helpfully identifies the extra "n" at the end of random is not a typo). To allow the program to pick a number between 1 and 100, I created my own function that is simply:
# Pick a Random Number
function pickNumber as numeric;
pickNumber=randomn(100) 1; # Pick the number
end;
Remember, CASL uses 0-based indexes or arrays so the value returned by randomn(100)
is actually 0 to 99,
hence the 1 to make it 1-100.
Ah, now I have a random number, exactly what my little program needed. The next step was to prompt for a guess, compare the two and respond if the entry was:
Correct (Player Wins)
The player has reached the maximum number of allowed guesses (Player loses).
Correct number is higher than what the player entered.
Correct number is lower than what the player entered.
Pretty simple stuff.
I created a function called "registerGuess" and assigned the function to the invokes item on the button (double-click the "Your Guess" button to see this association). The user types the number into the text box called "txtAnswer", and then taps the "registerGuess" button to register the input.
I also added the ability to use the Treo numeric keypad and press enter instead of tapping the button to enter a guess. I found you can create a function by the same name as the text control and then change the values typed. I checked for letters typed and changed them to the Treo numeric equivalent.
I added a menu bar and assigned it to my form. I wanted to use the menu bar to pop up a message box with my copyright information, product name, etc. One thing I noticed is that the Treo's five way pad's middle button can't be used to select the menu item; you must use the touch-screen. I contacted CASL support and they confirmed that this is a current limitation. While not a huge problem, I'd like to see this corrected. If you've used PalmOS programs where the five way's center button won't select a menu item, they were probably created with CASL. They'll fix it eventually.
It's Alive, it's Alive! "GuessMe" is complete. In this image you can see how the screen looks when the player doesn't guess the correct answer before the game is over.
Alas, the correct answer has been entered!
My simple little game is an entertaining time-waster and I hope you have some fun with it too. I could go on explaining all the remaining functions in the game, but instead I'll leave it to you to examine the main .csl file within the download. There you can see for yourself how the program works, how easy the code is and what makes it tick.
CASL on the PalmOS
If you want to examine the code or re-compile the GuessMe program, you will need a copy of CASL 4.3 installed on your system.
You can download CASL from the CASL Download page - the size of the file is about 5MB.
You also need to download the CASL Components installer (22MB) if you plan on compiling your application for PalmOS. The CASL Components installer is also available on the CASL Download page. When you compile an application for PalmOS, be sure to select "PalmOS Release" from the toolbar and the menu option "Build/C Build", and then select the menu "Build/Make PRC". CASL will then compile the application (to C code) and use GCC/PRC-Tools to generate the resulting .prc file. (If some of this sounds like geeky gibberish to you, don't worry, it did to me too until I got into it). The .prc file can then be transferred to the Treo's internal memory or it'll run just fine directly from your SD card.
In addition to creating the .prc, CASL includes a nice Application Install builder. Using it, you can quickly build and distribute your program to end-users. The installer allows assigning a graphic image, license agreement and many other options. Also included is the ability to install a conduit for your CASL databases. While my game doesn't include a database, this would be a useful feature for programs that need to collect data and transfer the data to the desktop computer. This capability exists for both PalmOS and PocketPC/Windows Mobile.
Frequent readers of TreoCentral may recall my earlier review of Nutshell. A brilliant way of installing multiple CASL database files along with your .prc would be to package all .pdb and .prc files using the Nutshell installer. Happily, it's getting more common for applications to be distributed OTA (Over the Air), so combining CASL (to create) and Nutshell (to pack and distribute) hands you a slick solution to reach new users and potential new customers.
CASL on Windows
Earlier I mentioned CASL-created programs can run under Windows, this is where I spent most of my CASL development time. Using CASL under Windows is the ideal way of testing your programs. You can work out bugs without having to compile, Hotsync and run it on actual Palm hardware. I'm not a big fan of Palm Desktop or the Hotsync manager by any stretch, so I prefer to do all my testing and debugging using the "Windows Release". This was a big time saver for me.
However, I did notice some minor differences between the "Windows Release" and the "PalmOS Release". In CASL under Windows, the text controls have a border (or outline) around them. On PalmOS, there are no borders. Also lacking is that CASL under Windows does not include an equivalent install builder which exists for the PalmOS and PocketPC release. This means you will need to build your own installer for distributing CASL applications for Windows.
CASL PocketPC/Windows Mobile (with Touch Screens)
I have a Treo 700wx on order, but unfortunately I did not receive it in time for this review. Although, from what I've read the GuessMe game should run equally well on Windows Mobile.
Flexibility and Cost
CASL lets you group related functions into ".cpk" files (or CASL Packages). These packages can be created by you or can be included from others CASL programmers. In my program I needed a function that let me search and replace one string with another. I found a CASL Sample on the CASL Support Board which performs this function. I copied the .cpk into my project directory, added the "#Include" statement in the main CASL file; select the menu option "Project/Update Includes". After doing this, all functions in the .cpk are available for use by my program.
For more advanced users, you can include your own C code to make direct API calls on PalmOS. You can do the same for Windows and PocketPC/Windows Mobile, although you will need to create a DLL that can be called by your CASL program. Fortunately, there are samples included in the CASL download package that demonstrate the basics of how to do this. This lets you perform advanced OS-specific calls within your own programs.
You should be happy to know that the download is the full version of CASL, and with it you can create applications of any size. The only limitation to the free trial version is that there's a notice displayed when the program you make with it starts up that says it was compiled using the free version of CASL. If you register your copy of CASL you get a license key that removes this notice and lets you distribute your applications for commercial purposes.
For new CASL developers the price is a reasonable $299, or $199 for customers upgrading an earlier purchased version of CASL. When you register you get a license key to remove the unregistered compiler message from your compiled CASL applications. You also get all updates and patches to CASL 4.3.x at no additional charge and special upgrade pricing for future version.
CASL's Competition
CASL is known as a Rapid Application Development (RAD) language. That is, you can create apps in less time than non-RAD environments. What other development tools do Palm developers use? Well, there are competing solutions such as: NSBasic, AppForge Crossfire, Satellite Forms and others. In comparison, the cost of a single CASL license is typically far less than many of these others. Additional savings can be realized for commercial and corporate developers as there are no client license fees associated with running your compiled CASL program on multiple machines. Other competitors charge as much as $30 per seat (each Treo) for the run-time. These are things to consider when making your decision.
Popularity
Having been around since 1996, (the year of the first Palm).. CASL has an impressive list of shareware and commercial applications that have been developed using this package. You probably won't be able to tell if a given Palm app is created with CASL. Some users have even been known to not share the fact they use CASL, as if people found out how easy it was to use they might be out of a lucrative job.
Also, CASL is used a lot for "internal" applications that don't show up as "for sale" commercial applications. These are typically database intensive apps for tracking jobs, inventories, sales and contacts, etc.
The list below is just a smidgen of some applications that advertise they were written in CASL, you may be using them on your Treo right now!
PDACookbook by WakefieldSoft
LectriCalc by Arkansoft
FlyBy Nav Pro
HealthFile by WakefieldSoft
PocketPlanter by Arkansoft
Cereal by Brainyware, LLC
LibertyControl by WAGWARE Systems, Inc. read the TreoCentral review
VCFPalm by Southeastern Data Technologies
TimeJar by JarDesign
Heybaby by WAGWARE Systems, Inc.
Conclusion >>
Copyright 1999-2016 TreoCentral. All rights reserved :
Terms of Use : Privacy Policy
TREO and TreoCentral are trademarks or registered trademarks of palm, Inc. in the United States and other countries;
the TreoCentral mark and domain name are used under license from palm, Inc.
The views expressed on this website are solely those of the proprietor, or
contributors to the site, and do not necessarily reflect the views of palm, Inc.
Read Merciful by Casey Adolfsson