![]() |
Home | Java | Palm OS | ASP COM | XML XSL | PHP | Personal | Your IP: 38.103.63.18 |
|
Palm Tutorial: Palm Links: |
What you need to have before you start this tutorial: I have used Metrowerks Code Warrior Rel. 5 with the Palm 3 running on Palm OS 3. for development. For actual testing and debugging I have used a Palm Pilot 3. Many wrote to me about problems they were facing while running the application using a Palm Emulator software(POSE). I have not tried it with POSE and hence cannot help you there. Sorry about that. Though some of the event handling, include files and resources may be specific to Code Warrior, the source code is fairly simple. If you are using Code Warrior or any other tool, please do the following: Create a simple application with 3 forms. You may give any names to the forms and the subsequent GUI elements. On:
Application Functionality: The application works in the following fashion -
Application Design: The application is designed in the following fashion - A user may create a new record or simply decide to edit an existing record. There is a main form where the application starts. The user starts either creating a new record or editing an existing one from this form. Case 1: The user wants to create a new record The user will click on the New Record button. This will start the event handling code and will present the user with form 1. Now there is a form open event - frmOpenEvent - which does initialization, if any, of the form before drawing - FrmDrawForm(FormPtr frm) - it. If a new record is being created then the text fields on form 1 just need to be set to show no text. A custom function sets the text in a text field -SetFldText(Word objectID, CharPtr pszBuf, Boolean bClearField ) - which takes the following arguments : the objectId of the text field object, a char pointer to the string you want to set and a boolen which decides whether you want to first delete the existing contents and redraw them. Now after the text fields are filled with text, the user clicks on the Next button, which will present form 2 to the user. But before this happens, the text in the two text fields on form 1 must be saved temporarily somewhere in memory. Similarly if the user enters text in text field on form 2 and decides to come back to form 1 for some modification or just like that, then the text in form 2 must also be saved temporarily somewhere in memory. On opening form 1, the text saved earlier on, must be read and set as the text in the two text fields. If the user modifies the text on form 1 and goes ahead to form 2, then again the existing text in fields on form 1 must be saved and so on. Finally on form 2 the user clicks the Save button and saves the record. Before we hand over all the strings to the Palm OS DataManager to save as a record we need to process these strings. These separate strings need to be combined as a single null terminated string. Then it must be presented as a single string to the Palm OS DataManager. After this string is stored as a record, the user is then taken to the main form where he can see the just created record in a list. Case 2: The user wants to edit an existing record For this the user taps a particular record displayed in the list. We have to determine - LstGetSelection (ListPtr ListP) - which record was tapped upon. We must then read that record from the database and read the null terminated text string. Next, break up this string into separate strings and finally populate the fields on each form accordingly. Once this is done the user must be allowed to go to and from between form 1 and form 2 to modify any text. Then finally when the user clicks the Save button, we have to remove or erase the current record and rewrite this newly modified record in its place. |
| Home | Java | Palm OS | ASP COM | XML XSL | PHP | Personal | Contact |