Copyright (c) 2004 Eric Pepke (ericpepke@earthlink.net)
Editor: Eric Pepke
Contributors: Ben Combee, Danny Epstein, Guilherme C. Hazan
The Palm OS One-Liners are intended as a public service to ehnahce the development of programs for devices running the Palm OS. Each One-Liner consists of 79 or fewer characters. They generally either point out facts or give advice. One-Liners are not comprehensive, but they should give enough clues that someone can find a longer answer easily. They are kept short so that people can read through them easily when looking for a solution.
Please contribute to the Palm OS One-Liners. The names of all contributors will be included. If you feel you have been left out, tell me. Right now, I'm trying to remember a trick posted by Ben Combee on how to get source to appear in disassembled code. I'm also looking for conduit and Cobalt advice. Plus anything else you can think of. I also request corrections and improvements.
The One-Liners are presented in the spirit of mutual cooperation for mutual benefit. I have copyrighted them because I have been burned by anti-cooperative behavior from rare individuals in the past.
You may distribute the Palm One-Liners by any means, provided that you include the entire list including this message and the names of all contributors and that you do not charge for the service. If you wish to include the One-Liners in commercial media, such as magazines, books, or CD-ROMS, contact Eric Pepke. I usually ask for a single copy of the published medium to keep track of where and when it has been published.
General
- You can use MemHandleFree and MemHandleResize on appInfo chunks.
- Every form with an editable field requires a Graffiti state indicator.
- Next and prev field gestures do not exist on Graffiti 2.
- If you can't find an answer to a question, check the sample applications.
- Use FrmHideObject and FrmShowObject rather than Hide/Show within objects.
- For best compatibility, use Glue functions whenever provided.
- Do not assume that a form will have enough memory to save its behind bits.
- Many versions of Palm OS impose a 64K limit on allocated memory.
- Avoid large globals; allocated memory or a database is usually better.
- Shared libraries cannot use globals at all.
- A MemPtrNew pointer fragments the heap less than a locked handle.
- FlpAToF and FlpFToA have bugs. Do not trust them.
- SysFatalAlert displays a dialog on Simulator; ErrFatalDisplay breaks.
- Virtual C++ functions produce overhead which may be significant on a Palm.
- The menu click area is as if the title were left-aligned, even when it isn't.
- Use selectors instead of popup triggers when the value edits the current record
- Use UI colors for highlighting to respect the user's preferences.
- The field insertion point and the selection do not cooperate well. Set both.
- SetFocus on a new field sets the insertion point to the end but does not scroll
- Roman characters are an adaptation of MicroSoft 1252, differing per version
- Japanese characters are an adaptation of MicroSoft 932.
- Call FrmDrawForm before drawing other things on the form.
- Labels cannot be given text longer than specified in the form resource.
CodeWarrior
- On a 68K code, functions with many API trap calls can overflow the stack.
- You can disassemble library files as well as source files.
68K Versus ARM
- ByteSwap16/32 return swapped values; they do not swap variables in place.
- Double-precision values need swapped as well; write your own swapping funcs.
- 68K compilers generally have 16-bit ints; ARM compilers, 32-bit ints.
- ARM is much pickier about alignment than 68K. See Read/WriteUnaligned32.
- To be safe with structs, always put larger elements first and pad if needed.
- Boolean and bool may differ. Boolean is 8 bits.
- sizeof() is a quick way to check most cases where struct alignment differs.
- Enums may differ in size between compilers, so avoid them in shared structs.
- Thumb discourages use of r8-r15, but some instructions access them.
- CodeWarrior uses r10 for global variables, which differs between PNOlets.
- Check the swapping of pointed-to values on PACE callbacks.
- Flp functions cannot be called as PACE callbacks. Write wrappers instead.
Symbol
- The Symbol API uses globals so cannot easily be called from a shared library.
Treo
- The Treo handheld phones do not support the Palm telephony manager.
