I have included the three routines that you will need to consider.
CreateLabel() is called with a parameter which describes the control I wish
to create.
(CControlPtr is a pointer structure of my own creation, which can be used to
describe many various controls, fields, etc...)
The Error exists within the SetFieldTextFromStr() call, for which the code
lies below. This function calls SetFieldTextFromHandle()
which is where the error occurs. The error (right at the bottom of the
email) is recorded in the Codewarrior Log window, while running
the application on POSE v3.0a6. I am using CW6 v4.01 Build 0436, all
running on NT 4.00.1381 Service Pack, IE 5 5.50.4134.0600 (which I believe
indicates Service Pack 6).
If anyone can provide a suggestion as to the cause of the error, I'd greatly
appreciate it. Thanks!
// CreateLabel
//
// Creates a new Field Object, posing as a Label, on the Form and
Initialises.
static Boolean CreateLabel(CControlPtr pControl)
{
FormPtr pForm;
FieldPtr pField;
FontID oldFont;
if (pControl->type != ctLabel) return false;
pForm = FrmGetActiveForm();
pControl->attr.resourceId = ++lastResourceId;
pField = FldNewField(
&pForm,
pControl->attr.resourceId,
pControl->attr.bounds.topLeft.x,
pControl->attr.bounds.topLeft.y,
pControl->attr.bounds.extent.x,
pControl->attr.bounds.extent.y,
pControl->attr.font,
StrLen(pControl->data.label.labelText)+1,
false, // not editable
false, // not underlined
true, // singleline
false, // not dynamically sized
leftAlign, // left justification
false, // no autoshift
false, // no scrollbar
false // not numeric
);
AssignFieldTextFromStr(lastResourceId, pControl->data.label.labelText);
if (!IsObjectVisible(pControl))
{
FldSetUsable(pField, false);
}
return true;
}
Codewarrior Log Window reports:
-----------------------------------------------
2297103: STARTING gComm->LoadTarget
2298344: FINISHED gComm->LoadTarget
Process Created: address=0x2539c
size=0x797e
cardID=0
dbID=0x2024f
Bus error exception at 0x10c46008 (FormatAndDrawFromPos)
-----------------------------------------------
Jason Garrett
wirelessdata
Ph: +64 9 379 3710 Fax: +64 9 379 7360 Cell: +64 21 400 307 ICQ: 44334435
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/