>I can't seem to find that on the Handspring site.
Perhaps they only put it in one of their developer e-mail
newsletters. Reprinted:
Technical Talk
Signal Strength & Battery Level Indicator
Displaying the signal strength and battery level of the Treo is very
easy to do and only takes a few lines of code. This method will allow
you to display the same signal strength and battery level icons that
are displayed in the Launcher and other built-in applications thus
allowing you to maintain a consistent look and feel of the UI. NOTE:
This procedure does not apply to VisorPhone. We do not have a way to
display the signal strength and module battery level on the
VisorPhone. The resource format in the example shown below is for RCP
files. For CodeWarrior resource files, please consult the appropriate
documentation.
The signal strength and battery level are system gadgets that can be
displayed on any form. The first step is to add two gadget resources
to your main form as shown below:
// System status gadget so width and height are actually ignored
// Place these gadgets on the upper-right corner of the form
GADGET ID MainSignalLevelGadget AT (130 0 16 12)
GADGET ID MainBatteryLevelGadget AT (150 0 10 12)
In my header file I have defined the IDs as,
#define MainSignalLevelGadget 1010
#define MainBatteryLevelGadget 1011
NOTE:
These values will depend on your particular resource file
To tell the system to use the above gadgets to display the
appropriate information, use the following code sample:
..
UInt32 hsStatusVersion;
if (FtrGet (hsFtrCreator, hsFtrIDStatusGadgetRev, &hsStatusVersion) == 0)
{ HsStatusSetGadgetType (frmP, MainBatteryLevelGadget, hsStatusGadgetBattery);
HsStatusSetGadgetType (frmP, MainSignalLevelGadget, hsStatusGadgetSignal);
}
..
NOTE:
This should be called after the FrmDrawForm() call. The frmP variable
should be the pointer to the active form. Typically one would put
this in the frmOpenEvent event handling routine. All the Hs*
functions and values are defined in the HsExt.h file.
Once the gadgets are "installed" they will automatically be updated
based on the current battery level and state (charging or not) and
the signal level. No additional code is required.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/