I'm adapting the example of Forms Management here and found AppLog to mangle my reported strings strangely.
void
MyFormsApp::OnUserEventReceivedN (RequestId requestId, IList *pArgs)
{
AppLog("OnUEveRxdNb, beginning");
if(!pArgs) {
AppLog("OnUserEventReceivedN, null List");
return;
}
if(requestId==TabsForm::TABS_SWITCH_CALL)
{
Integer * tabindex = static_cast<Integer *>(pArgs->GetAt(0));
MyLog(L"OnUEveRxdN, formID : ", formID->ToInt());
//MyLog(L"OnUserEventReceivedN, formID : ", formID->ToInt());
if(tabindex)
{
switch(tabindex->ToInt())
{
case TabsForm::SEARCH_TAB:
frame_->SetCurrentForm(*search_form_);
search_form_->RequestRedraw(true);
break;
case TabsForm::RESULTS_TAB:
frame_->SetCurrentForm(*results_form_);
results_form_->RequestRedraw(true);
break;
case TabsForm::CONTENTS_TAB:
frame_->SetCurrentForm(*contents_form_);
contents_form_->RequestRedraw(true);
break;
}
}
}
pArgs->RemoveAll(true);
delete pArgs;
} //closebracket
MyLog is
void MyLog(const String &badaStr) {
char *natStr = new char[badaStr.GetLength()];
for (int i = 0; i < badaStr.GetLength(); ++i)
natStr[i] = badaStr[i];
AppLog(natStr);
delete[] natStr;
}
void MyLog(const mchar *pValue, const int int_param) {
String str(pValue);
result r = str.Append(int_param);
MyLog(str);
}
void MyLog(const char *pValue, const int int_param) {
String str(pValue);
result r = str.Append(int_param);
MyLog(str);
}
If you see where I've got the two calls to it the second was commented out because it appends garbage to the end of my string. I call these functions from various other places in my application without trouble but here the string must be truncated. It's not a total char
count per function either because replacing the first AppLog
with AppLog("BadaReader::OnUserEventReceivedN, beginning");
makes no difference.
Can anyone spot my mistake or is Bada 2.0.2 known for this kind of random glitch?