I have a program on a Visor Prism that dynamically creates a label
resource, then ends up removing it again without ever having actually drawn
it. Whenever I attempt the remove, however, I get a fatal error saying that
I have accessed an odd address. I can't find a bug database at palmos.com,
nor do I know where to report this, but I'm sure someone will enlighten me.
I pulled the offending functionality out into a little test harness program
that I use and was able to duplicate the behavior. Furthermore, I was able
to determine a specific condition that seems to cause the bug. Check out
this pilrc resource file:
FORM ID 1 AT (0 0 160 160)
NOFRAME
NOSAVEBEHIND
USABLE
BEGIN
SCROLLBAR ID 11 AT (154 0 7 160)
NONUSABLE
END
With this resource file, the bug occurs -- FrmRemoveObject() for the label
causes a fatal error saying I've read from address 0x13. If I remove the
two lines defining the scrollbar resource, however, the bug does not occur.
The scrollbar is never drawn, BTW. Here is my little test program. No, it
is not indicative of my normal coding style, it is just a quick-and-dirty
test harness that I use to try out little code snippets. The relevant stuff
starts at the "Experiment area start" comment:
#include <PalmOS.h>
FormType *theForm;
void waitForEvent(eventsEnum theOne)
{
EventType e;
while (1) {
EvtGetEvent(&e, -1);
if (!SysHandleEvent(&e)) {
if (e.eType == theOne) return;
FrmHandleEvent(theForm, &e);
}
}
}
UInt32 PilotMain(UInt16 cmd, void *cmdPBP, UInt16 launchFlags)
{
EventType e;
Err err;
RectangleType r;
RGBColorType rgb;
WinHandle win;
UInt16 idx;
FrmGotoForm(1);
waitForEvent(frmLoadEvent);
theForm = FrmInitForm(1);
waitForEvent(frmOpenEvent);
FrmSetActiveForm(theForm);
FrmDrawForm(theForm);
waitForEvent(winEnterEvent);
/* Experiment area start */
FrmNewLabel(&theForm, 1001, "Pop Goes the Weasel", 10, 10, stdFont);
idx = FrmGetObjectIndex(theForm, 1001);
FrmRemoveObject(&theForm, idx);
/* Experiment area end */
waitForEvent(appStopEvent);
}
This is a problem for me because I can't re-use labels (no way to change
their text and resize them accordingly), so my only recourse is to remove
the old label and create a new label with different text. But now that
won't work.
I'd appreciate knowing where I can report this bug, and where I can search
for other known bugs.
Curtis Jackson
Director of Engineering
Aniwhere, Inc.
[EMAIL PROTECTED]
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/